By Flávio Zavan, UFPR Brazil
Vasya and Petya work as secretaries of the Breading of Crabs Course (BCC) in the Physic University of Shallow Beach (UFPR, in Nlogonian). Every year they welcome N freshmen that need to receive their credentials to access their system.
Each student gets an username based on his full name. The username is generated by concatenating the first letters of each word of the name, and then attaching it to the year he entered the university. For example, if Fulado de Tal entered the university in 1998, his username will be fdt1998.
Problems appear when more than one student must have the same username. In that case, one of the students gets an username according to the rules above, while the other ones get non-standard usernames, i.e., usernames that do not follow the rules above.
Many freshmen entered the university this year. Vasya and Petya asked for your help to write a program that, given the full name of all freshmen and the current year, determine how many students will get non-standard usernames.
The input contains several test cases. The first line of each test case contains two integers N (1 ≤ N ≤ 5×104) and Y (1 ≤ Y ≤ 9999), the number of freshmen and the current year, respectively.
Each of the next N lines contain the full name of a freshman. Each line contains at most 100 characters. Each line contains lowercase letters and spaces only. There is at least one letter in each line.
The input ends with end-of-file (EOF).
For each test case, print a single line with the number of students that will get a non-standard username.
Input Sample | Output Sample |
10 1998 |
3 |