I seem to be producing the correct output:-
300 0 0 2 4 5
team 1: 1, 1500
1 1 1 1 1 1
team 2: 3, 3
0 0 0 0 0 0
team 3: 0, 0
0 0 0 4 5 6
team 4: 0, 0
0 777 0 4 1 1
team 5: 1, 777
0 777 0 4 2 1
team 6: 1, 1977
Maybe my problem is related to end of input.
Code removed
Any advice would be welcome