[This question differs from this one because here the lines are allways different (every line has a different number). My input/output examples may look very similar, but in the real application they are not.]

That is: the first time, count how many times each second block occurs. The second time, keep appending an incrementing number to those that appear more than once. So instead of comparing the whole line, it compares the second field, which is everything from the colon :.