Your task is to decipher a non-empty string consisting of printable ASCII characters in the range [32..126].
Reading the string character per character:
- each time you encounter a letter in lowercase, associate it with the next letter in uppercase, starting with 'A'
- each time you encounter a letter in uppercase, replace it with the letter in lowercase it's associated with
- other characters do not require any special processing and are just left unchanged
For the input string
The final output is
Clarifications and rules
- The input string is guaranteed to contain each lowercase letter at most once. All further instances will be replaced with the corresponding capital letter.
- The input string is guaranteed to be valid. (You will not encounter a capital letter that is not yet associated with a lowercase letter.)
- Once a capital letter has been associated to a lowercase letter, it may or may not be used later in the string. For instance,
Dare not used in the above example.
- This is code-golf, so the shortest answer in bytes wins!
progBamFinD AuzJles & cCdL DCKf
sphinx of black quKrtz, jOdge my vGw. K NODLM IPGZE HGF SOWBA GYVP QCV JKRX TGU.
petBr AiABD AEckBd a ABFG of AEFGlBH ABAABDs. hJw mIny AEFGLBH ABAABDM HEH ABCBD AEABD AEFG?
programming puzzles & code golf
sphinx of black quartz, judge my vow. a quick brown fox jumps over the lazy dog.
peter piper picked a peck of pickled peppers. how many pickled peppers did peter piper pick?