In the land of TSSOJ, there are certain fruits that are banned for being too fruity.
The path of the boats is visualized in the following image:
Your task is to determine how much of each fruit will be collected.
Input Specification
The first line of input, represents the number of fruit from one end of the lake to directly across on the other. In other words, the lake can be split into a grid of size x with a fruit in each square. It is guaranteed that will be odd.
The next lines will contain space separated letters representing the type of fruit that is in each square. A
for apple, B
for banana and C
for coconut.
Output Specification
Output 3 integers, each on a new line representing the number of each type of fruit collected, in the order of apples, bananas, coconuts.
Subtask 1
For 5/7 of the points, .
Sample Input
5
A A B A C
B A C C A
C C B A B
C A C B C
A B A A A
Sample Output
5
2
2
Explanation for Sample Input
The path of the fruit boats is visualized in the following image:
In total, the boats will encounter 5 apples, 2 bananas, and 2 coconuts.
Comments