Bob's Journey
Practice
3.9 (9 votes)
Open
Approved
Hashing
Easy
Problem
59% Success 9153 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Bob is travelling from one city to another. In his way, he sees many other cities pass by. What he does instead of learning the full names of the cities, he learns just the first character of the cities. For example, if he passes by "bhopal", he will just remember the 'b'.

Given the list of N cities that come in his way, print "YES" or "NO" depending on if he is able to remember all the cities distinctly or not.

Note: City name consists of small English alphabets only.

Input and Output:
First line contains T, the number of testcases. Each testcase consists of N, the number of cities. Next N lines contain the names of the cities.
For each testcase, print "YES" or "NO" (quotes for clarity).

Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 1000
1 ≤ Length of each city name ≤ 10

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
150 votes
Tags:
EasyOpenHash functionHash table
Points:20
11 votes
Tags:
Basic ProgrammingEasyOpenApprovedHash table
Points:20
12 votes
Tags:
Hash tableHashMapBasic ProgrammingEasyOpenApproved