Curse dictionary
Time Limit: 8000/5000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 9543 accepted submission (s): 2449
Problem description one of Harry Potter's required courses at Magic School is to learn the magic curse. It is said that there are 100000 different magic spells in the magic world, and it is hard for Harry to remember them all. But in order to combat a strong enemy, he must be able to call any desired magic curse in a critical moment, so he needs your help.
Here is a magic dictionary. When Harry hears a curse, your program must tell him the function of the curse. When Harry needs a function but does not know what curse to use, your program needs to find the appropriate curse for him. If the curse he wants is not in the dictionary, he will output "what ?"
Input first lists no more than 100000 different magic terms in the dictionary, in the following format:
[Curse] Functions
The "curse" and "corresponding function" are strings of no more than 20 and 80 respectively. The strings do not contain the characters "[" and "]". there is only one space between "]" and the subsequent string. The last line of the dictionary ends with "@ [email protected]". This line does not belong to the entry in the dictionary.
The row after the dictionary contains a positive integer N (<= 1000) followed by n test cases. Each test case occupies one line, or "[curse]" is provided, or "corresponding function" is provided ".
Output the output of each test case occupies one line, and outputs the corresponding function or function. If the curse is not in the dictionary, "what?" Is output ?"
Sample input [expelliarmus] The disarming charm [rictusempra] Send a jet of silver light to hit the enemy [tarantallegra] control the movement of one's legs [serpensortia] Shoot a snake out the end of one's wand [lumos] Light the wand [Obliviate] The Memory Charm [expecto patronum] Send a Patronus to the dementors [accio] The Summoning Charm @ [email protected] 4 [lumos] The Summoning Charm [arha] Take me to T He sky sample outputlight the wandacciowhat? What?