CodePSU 2018 - Intermediate


2018-03-18 19:00 CET

CodePSU 2018 - Intermediate


2018-03-18 23:00 CET
The end is near!
Contest is over.
Not yet started.
Contest is starting in -33 days 14:01:19

Time elapsed


Time remaining


Problem E
ISS Travel Logs

The Interplanetary Space Station, located at the midpoint of Mercury and Jupiter, has a registry of all space flights to and from its ports. Each flight is identified by a six-digit ID number. The first digit of that ID number signifies the origin or destination country of those flights. The last digit of that ID number signifies the level of difficulty of the flight.

Earth’s Department of Data Delivery needs these ID numbers to be easily classifiable and accessible based on these two digits. Specifically, the department needs to know if these two digits are the same in certain cases and, if so, how many occurrences of these two digits there are.


The input consists of $N$ test cases ($1 \leq N \leq 100$), each test case consisting of a line. The first line of input contains the single integer N, indicating how many lines will follow the first line. Each line after the first line contains a string of L ID numbers ($1 \leq N \leq 100$). There will be a single space separating each ID number on all lines. Each ID number is entirely numeric and the length of each ID number is always $6$ digits.


For each N test cases of ID numbers in the input, output one line, containing the number of occurrences of unique matches of the first and last digits of every possible first/last number combination separated by commas, in order from $00$ to $99$. Cases where there are zero occurrences should be excluded. The number of lines of output should correspond to the number of test cases $N$.

Sample Input 1 Sample Output 1
012340 092470 589199 012345
557840 543640 251805 232835
214497 580409 001279 531281 900388
413989 772246 625761 930964 767396 944064
2 1 1
2 2
1 1 1 1 1
1 1 2 2