#C9907. Generating Unique Participant IDs

    ID: 54052 Type: Default 1000ms 256MiB

Generating Unique Participant IDs

Generating Unique Participant IDs

This problem requires you to generate unique participant IDs based on their last names and the order in which they appear. For each participant, you need to append the number of occurrences of that last name so far. For example, if the last name Lee appears twice, then the first occurrence is assigned Lee1 and the second Lee2.

More formally, if we denote by \( c(name) \) the count of occurrences of name up to the current position, then the unique ID for that participant is:

[ ID = \texttt{last_name} \Vert c(\texttt{last_name}), ]

where \(\Vert\) denotes string concatenation. Your solution should read from stdin and output the result to stdout.

inputFormat

The input is given via stdin in the following format:

  1. The first line contains an integer n representing the number of participants.
  2. If n > 0, the second line contains n space-separated strings, each representing a last name.

outputFormat

Output a single line to stdout containing the generated participant IDs, separated by spaces. If there are no participants (i.e., n = 0), output an empty line.

## sample
4
Lee Wang Kim Lee
Lee1 Wang1 Kim1 Lee2

</p>