Dealing with duplicate records
npeople in an old database. Engineers struggle to extract useful information from the dataset as some names collide. You are asked to help them so that they can work with that data. The database contains user names and their birth dates. There are many duplicate names and you are asked to de-duplicate them by adding a number next to them. If there are two people named
Anna, then the program should keep the first one and add a
1to the second one. That will result in
Anna1. If another
Annais present in the database, the program should assign
Anna2to the name.
The first line of the input contains a single integer
n. The next
nlines contain space-separated names and birthdates.
The program should print
nlines, each with a unique name in the described format, and the corresponding birthdate.
5 Anna 08/08/1999 Bob 02/02/1998 Steven 09/02/2000 Anna 01/04/2004 Anna 01/04/2004
Anna 08/08/1999 Bob 02/02/1998 Steven 09/02/2000 Anna1 01/04/2004 Anna2 01/04/2004
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB