You are given two strings, key and message, which represent a cipher key and a secret message, respectively.
To decode message, construct a substitution table using key according to the following steps:
Traverse key from left to right and take the first appearance of each unique lowercase English letter.
Map these unique letters in order to the standard 'a', the second to 'b', the third to 'c', and so on up to 'z'.
Spaces ' ' are not mapped and remain as spaces ' '.
Using the substitution table, decode every character in message and return the resulting decoded string.
Constraints:
key.length
key consists of lowercase English letters and ' '.
key contains every letter in the English alphabet ('a' to 'z') at least once.
message.length
message consists of lowercase English letters and ' '.
You are given two strings, key and message, which represent a cipher key and a secret message, respectively.
To decode message, construct a substitution table using key according to the following steps:
Traverse key from left to right and take the first appearance of each unique lowercase English letter.
Map these unique letters in order to the standard 'a', the second to 'b', the third to 'c', and so on up to 'z'.
Spaces ' ' are not mapped and remain as spaces ' '.
Using the substitution table, decode every character in message and return the resulting decoded string.
Constraints:
key.length
key consists of lowercase English letters and ' '.
key contains every letter in the English alphabet ('a' to 'z') at least once.
message.length
message consists of lowercase English letters and ' '.