• [C] Chihuo III - List

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Carrying the plan, Tianyi and Zhengling start to eat.
    They make a "base list" at first. It shows what they will eat.
    It's something like that:

    ~ Breakfast ~
    Major :	Egg
    Minor:          Sausage
    Drink    :Milk
    ~ Lunch ~
    Major   : Rice
    Minor1:Dongporou
    Minor2  : Jiangmikourou
    Drink : Fanqiedantang

    And after they reached each place, they will change their list like that:
    Breakfast->Drink : Ewe_s_Milk
    The command above means changing the drink of breakfast to Ewe'sMilk or adding the drink Ewe'sMilk to breakfast.

    Breakfast->Drink : __NULL__
    The command above means deleting the drink of breakfast no matter it exists or not.

    What's more, Tianyi will ask for quering some food, like:
    :Breakfast->Drink

    You should give her a answer. If it not exists, you should output "No such food".

  • 输入
  • This problem conatins several cases.
    The first line of input is an integer C, indicates the number of cases.
    The first part of each case is a base list, input until '----------'.
    Each title is contains a '~', a space, the name of title (no longer than 20 without space/tab), a space and a '~'.
    Each part of body contains not quantitative space/tab, the name of body (no longer than 20 without space/tab), not quantitative space/tab, a ':', not quantitative space/tab, the content of body (no longer than 20 without space/tab) and not quantitative space/tab.
    The second part of each case is a change list.
    If it's a query command, it will be strictly like that:
    :Title->Body
    If it's a changing / adding / deleting command, it will be strictly like that:
    Title->Body : Value
    Input until '----------'

    Each title, body and value only contain uppercase letters, lowercase letters and '_'.
  • 输出
  • For each query, you should output its value.
  • 样例输入
  • 1
    ~ Lunch ~
    Major   : Rice
    	Minor1:Dongporou 
        Minor2  : Jiangmikourou    
    Drink : Fanqiedantang
    
    ~ Breakfast ~
    Major :	Egg
    Minor:          Sausage
    Drink    :Milk
    ----------
    :Breakfast->Drink
    Breakfast->Drink : Ewe_s_Milk
    :Breakfast->Drink
    Breakfast->Drink : __NULL__
    :Breakfast->Drink
    ----------
    
  • 样例输出
  • Milk
    Ewe_s_Milk
    No such food
    
  • 提示
  • 来源
  • XadillaX
  • 操作

显示春菜