UptoSkills Pizza Party
It's pizza party time at UptoSkills Arena! The student committee ordered a bunch of pizzas, and each pizza has a list of toppings. They want to know which topping is the most popular, meaning it appears on the most pizzas. If there's a tie for the most popular topping, they'll choose the one that comes first alphabetically. Help them find that winning topping!
Input
The first line contains an integer N, the number of pizzas. Each of the next N lines describes a pizza, starting with an integer K, the number of toppings on that pizza, followed by K strings representing the toppings.
Output
Print a single string: the name of the most popular topping. If there is a tie, print the topping that comes first alphabetically.
Constraints
1 <= N <= 50 1 <= K <= 10 Each topping name consists of lowercase English letters and has length between 1 and 10. There will be at least one pizza and one topping.
Example 1
3 3 pepperoni mushroom onion 2 mushroom cheese 4 pepperoni olive mushroom
mushroom
Mushroom appears on 3 pizzas, pepperoni on 2, onion on 1, cheese on 1, olive on 1. Mushroom is the most popular.
Example 2
2 2 ham pineapple 3 ham bacon pineapple
ham
Ham and pineapple both appear on 2 pizzas. Ham comes first alphabetically.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
3 3 pepperoni mushroom onion 2 mushroom cheese 4 pepperoni olive mushroom
2 2 ham pineapple 3 ham bacon pineapple