HDU 1880 curse dictionary

Source: Internet
Author: User
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.