Here's what matters: maps associate values with keys. For this problem, The approach is the username and the value is how many times you've seen it. When a username arrives, check if it exists in the map.
I'll show you the logic. If the username isn't in the map, output OK and add it with count 0. If it is, get its count, output the username with that count as suffix, then increment the count.
For example, first "john" gets OK and map stores john:0. Second "john" sees count is 0, outputs john0, updates to john:1. Third "john" outputs john1, updates to john:2.