You are given two strings key and message.
The key is a permutation of the alphabet used to create a substitution cipher:
- Non-space characters appear in key in the order they first appear; each maps to a→b→c→... in order.
- Spaces map to spaces.
Decode and return the decoded message.
Input format: key|message
Input: Two '|' separated strings: key and message.
Output: The decoded message string.
Input: the quick brown fox jumps over the lazy dog|vkbs bs t suepuv
Output: this is a secret
Explanation: Build mapping from key's first-occurrence order; decode message.Input: abcdefghijklmnopqrstuvwxyz|hello world
Output: hello world
Explanation: Identity cipher — output equals input.Input: zyxwvutsrqponmlkjihgfedcba|hello world
Output: svool dliow
Explanation: Reversed alphabet cipher.26 <= key.length <= 2000key consists of lowercase letters and spacesmessage.length <= 2000message consists of lowercase letters and spaces