33
5
This challenge is inspired by one of my other challenges: Pointlessly make your way down the alphabet
That challenge asked you to take a string of text, and for each letter produce a sequence of letters moving down the alphabet to 'a'.
For this challenge I'd like to decode the output of that challenge (minus the line breaks), to find a human-readable string from a much longer human readable string.
Here is some text which has been encoded using the Dreaded Alphabet Cypher™️
hgfedcbaedcbalkjihgfedcbalkjihgfedcbaonmlkjihgfedcba wvutsrqponmlkjihgfedcbaonmlkjihgfedcbarqponmlkjihgfedcbalkjihgfedcbadcba
It consists of descending alphabetical sequences, ending in an 'a'. The first character in each of these sequences is a letter in the decoded text. (A space is still a space).
The challenge
- Write code to convert a Dreaded Alphabet Cypher™️ encoded string into a decoded, human-readable string.
- No need to validate if it is a Dreaded Alphabet Cypher™️ string, I'm not interested in how it handles invalid input.
- Use any language you please.
- Please include a link to an online iterpreter.
- The input will only consist of lower-case letters and spaces. No upper cases, punctuation etc.
- Code golf, try to write short code, standard loopholes etc.
Test Cases
Input:
hgfedcbaedcbalkjihgfedcbalkjihgfedcbaonmlkjihgfedcba wvutsrqponmlkjihgfedcbaonmlkjihgfedcbarqponmlkjihgfedcbalkjihgfedcbadcba
Output:
hello world
Input:
abacbadcbaedcbafedcbagfedcbahgfedcbaihgfedcbajihgfedcbakjihgfedcbalkjihgfedcbamlkjihgfedcbanmlkjihgfedcbaonmlkjihgfedcbaponmlkjihgfedcbaqponmlkjihgfedcbarqponmlkjihgfedcbasrqponmlkjihgfedcbatsrqponmlkjihgfedcbautsrqponmlkjihgfedcbavutsrqponmlkjihgfedcbawvutsrqponmlkjihgfedcbaxwvutsrqponmlkjihgfedcbayxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba
Output:
abcdefghijklmnopqrstuvwxyz
(beware the multiple a's)
Input:
aarqponmlkjihgfedcbaonmlkjihgfedcbanmlkjihgfedcba a aarqponmlkjihgfedcbaonmlkjihgfedcbanmlkjihgfedcbasrqponmlkjihgfedcbaonmlkjihgfedcbanmlkjihgfedcba hgfedcbaasrqponmlkjihgfedcba anmlkjihgfedcba aarqponmlkjihgfedcbadcbavutsrqponmlkjihgfedcbaarqponmlkjihgfedcbakjihgfedcba
Output:
aaron a aaronson has an aardvark
Input:
hgfedcbaaponmlkjihgfedcbaponmlkjihgfedcbayxwvutsrqponmlkjihgfedcba gfedcbaonmlkjihgfedcbalkjihgfedcbafedcbaihgfedcbanmlkjihgfedcbagfedcba
Output (is a secret, shh)
May the input contain leading or trailing spaces, or several spaces in a row? – Arnauld – 2019-11-29T14:17:51.857
@Arnauld I'm happy with trailing and leading spaces, but not within the result itself. – AJFaraday – 2019-11-29T14:19:05.550
Sorry, I meant the input, not the output. (I've edited my previous comment.) – Arnauld – 2019-11-29T14:20:08.197
@Arnauld The input could have trailing and leading spaces. – AJFaraday – 2019-11-29T16:43:07.867
May our input & output types differ (e.g. string in, list of characters out?) - maybe we have a meta consensus...? – Jonathan Allan – 2019-11-29T18:38:48.403
1@JonathanAllan sounds fine to me – AJFaraday – 2019-11-29T19:12:57.207
Alexa, announce "hgfedcbaedcbalkjihgfedcbalkjihgfedcbaonmlkjihgfedcba wvutsrqponmlkjihgfedcbaonmlkjihgfedcbarqponmlkjihgfedcbalkjihgfedcbadcba" – MooseBoys – 2019-12-02T10:31:36.297