Problem Description

Given a list of students with name and city, group them by city and print each city with names in input order.

Input Format

First line n. Next n lines: name city.

Output Format

Each city on new line as: City: name1,name2

Sample Test Case

Input:
5 Ravi Pune Neha Delhi Aman Pune Zara Delhi Isha Pune
Output:
Pune: Ravi,Aman,Isha Delhi: Neha,Zara

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next