Hi Vlad,
The expected output is that it should print the input as it is and then print the totals. The totals should be sorted numerically on the first field.
To achieve this. I add up the counter in the body and keep printing the lines as it is. In the END part I do all the post processing...