LearnPy Hub
← Dictionaries problems
Medium

Who Lives Where?

Read n lines name city. Print each city (alphabetical) followed by the number of people and their names sorted, like Dhaka 2: Mim Rafi.

Input

n, then n lines.

Output

Lines.

Sample 1

Input
3
Rafi Dhaka
Sara Sylhet
Mim Dhaka
Output
Dhaka 2: Mim Rafi
Sylhet 1: Sara

Sample 2

Input
1
A X
Output
X 1: A
solution.py
Output appears here
Who Lives Where? · Python practice problem · LearnPy Hub