An insecure method of encrypting text is to replace a known word with another specific word. To ensure that the encryption is reversible, no two words are replaced by the same word.
Your task is to decrypt several encoded lines of text, given the set of replacements.
The input consists of a line containing an integer n followed by n lines, each with a lowercase word and its corresponding encrypted form. The n words compose the dictionary of words which may appear in the decrypted text and are listed in alphabetical order.
Following the dictionary are several lines of input. Each line is encrypted as described above.
There are no more than 1,000 words in the dictionary. No word exceeds 16 letters.
The encrypted lines contain only lower case letters.
Decrypt each line and print it to standard output. If there is no solution, replace every letter of the word by an asterisk.
fovl smf ksme smf fovl
ghj smf fovl Sample Output
dick and jane and dick
*** and dick
Did you just copy your assignment problem description and paste it here with no explanation of what you have tried so far?