Pea Soup and Pancakes
InterviewTime limit1sMemory limit512 MB
Read each restaurant's name and menu, then print the first one serving both pea soup and pancakes, or a fixed fallback line if none does.
- Level
Easy2 of 10
- Topics
- Implementation, String, Hash map, Brute force
- Solved
- No attempts yet
Problem
As a Swede, you have a deep love for the traditional Thursday lunch of pea soup and pancakes. You love it so much that you will eat it at any meal where it is available. You find yourself looking at the menus of all your favorite restaurants every day to see whether this combination is available, and you realized you could do this more easily with a program. Given a list of restaurant menus, decide where to eat.
Input
The first line of input contains a number (), the number of restaurants. Then follow the restaurant menus. Each menu starts with a line containing a number (), the number of menu items for the day. The remainder of the menu consists of lines, each containing a nonempty string of at most 100 characters. The first of these lines is the restaurant name, and the rest are menu items. Strings consist only of lower case letters 'a'-'z' and spaces, and they always start and end with a letter. All restaurant names are unique.
Output
Output a single line. If at least one restaurant has both "pea soup" and "pancakes" as menu items, output the name of the first of those restaurants, by the order in which the restaurants appear in the input. Otherwise, output "Anywhere is fine I guess".