Jerry has a secret girlfriend, and they have to communicate with each other using secret messages. Jerry needs your help to decode the messages that his girlfriend sends to him.
The message is encoded using a code provided to Jerry. The code is a list of numbers that indicates which characters to select from the secret message.
The characters are selected in the order specified by the code(You need to sort the code, and take the character from the smallest position to the biggest position one by one). If a character in the secret message is "*", it indicates a whitespace.
Once all the specified characters have been selected from the secret message, they are concatenated and converted to uppercase to form the final message.
Hint. You could use sort()
function to sort the list.
One line of code, following a line of secret message.
The format of each line is given as:
Code
Secret Message
Examples are shown below.
5 4 3 11 10 13 9 8 7 2
YI*loJVe*yoJUXJ
The output will be
I LOVE YOU
Take the 2nd, 3rd, 4th... 13th character from the secret message (from the smallest character position to the biggest one). Replace "*" with whitespace and convert the resulting string to uppercase. Then you would get the final output.