One Case to Rule Them All
Ashgrove Tours lets its agents type the destination city by hand, so the same place reaches the database as Paris, PARIS or paris depending on who was at the keyboard that afternoon. The end-of-season summary needs to know how many places the company actually sold, and one place typed three ways is still one place.
Task: Print how many different cities appear, treating names that differ only in capitalisation as the same city.
Input
The first line holds one integer n, how many city names follow. Each of the next n lines holds one city name. Capitalisation is arbitrary and may change from line to line. Two names that refer to the same place are otherwise spelled identically.
Output
One line holding a single whole number: how many different cities the log contains.
Example:
Input:
4
Paris
PARIS
london
Paris
Output:
2
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in