|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||14||9||8||61.538%|
An empty train on a train station is waiting for passengers to board. The train consists of N cars and each car can accommodate K passengers.
The train station is swamped with strange demands. Passengers board the train one by one and go to one of the cars in which there are free seats left. Each passenger chooses a car to board according to the following rules:
Write a program that, given the list of passengers which are boarding the train, determines the number of passengers in each car after boarding has completed.
The first line contains two integers N and K, 1 ≤ N ≤ 10, 1 ≤ K ≤ 10, the number of cars and the number of passengers each car can accomodate.
The second line contains an integer P, 1 ≤ P ≤ N·K, the number of passengers waiting to board.
The next P lines contain the names of all passengers, in order in which they will board. The name of each passenger is a string of at most 10 lowercase letters of the English alphabet. No two passengers will have the same name.
Output N integers separated by single spaces on a single line, the number of passengers in each car, in order from first car to last.
3 2 3 anka branko cvjetko
1 1 1
2 2 4 mirko nenad ozren nino
4 3 6 goranka mirko marin antun petar mladen
2 1 1 2
Clarification for first example: When Anka is boarding, the train is empty; according to rules 1 and 2 she can choose any car, so she chooses the first car according to rule 3. Rule 1 also allows Branko to entery any car, but rule 2 limits him to the second and third. By rule 3 he enters the second car. Cvjetko enters the third car by rule 3, since it is empty.