#0004BD

O-Flowers

Milica can not wear her old woolen cap to keep hair in one place so she decide to buy some hairpins in shape of flowers. On nearby market Milica saw on one stand lot off hairpins, but then she realized that her pockets are not deep enough for this purchase. Seller offer one opportunity to Milica: he will give her couple of hairpins if she can solve next task.


On rectangular plate MxN divided in squares 1x1, colored with various colors, are "hidden" flowers. Seller expect from Milica to answer how many flowers of every of three types are on plate?


Image: cvece

When You consider flower of any type only thing that matter is: all parts of flower same colored on prototype must be same colored on plate as well. This can be any color. White parts of prototype can be any color. Milica is keen to replace boring cap but she is color blind and ask You for help.


InputIn first line of input are two integers N and M: (5 <= N, M <= 1000) dimension of plate. In next N lines will be M uppercase or lowercase letters, representing 52 different colors.

OutputIn first three lines of output print number of flowers match prototypes. In first line for first type, in second for second type, and in last line print number of flowers match third prototype.

Example 1:

Input:

5 5
XXXXX
XXXXX
XXXXX
XXXXX
XXXXX

Output:

1
1
1



Example 2:

Input:

5 5
OXOXO
XXZXX
OZOZO
XXZXX
OXOXO

Output:

1
1
0



Example 3:

Input:

5 7
ABCDEAQ
FGHIJWE
KLNMORT
PQRSTZT
UVWXZYL

Output:

0
0
0



NOTICE: if you put in example 2 on position (3,3) some other color then 'O' flower of type 2 will not be correct.



Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.