Decode the Message
You're provided with two strings: key and message. Key represents a cipher key, and message is the secret message you need to decode. The decoding process involves the following steps:
- Utilize the first occurrence of all 26 lowercase English letters in key to establish the order of the substitution table.
- Align the substitution table with the regular English alphabet.
- Substitute each letter in the message using the established table.
- Spaces (' ') remain unchanged.
For instance, given key = "happy boy" (the actual key should contain at least one instance of each letter in the alphabet), we derive a partial substitution table as follows: ('h' -> 'a', 'a' -> 'b', 'p' -> 'c', 'y' -> 'd', 'b' -> 'e', 'o' -> 'f').
Your task is to print the decoded message.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)