Team Tic Tac Toe#10381

Team Tic Tac Toe

1 second
128 megabytes
Easy

Farmer John owns cows, whose names, by happenstance, all start with different letters of the alphabet, so Farmer John usually refers to each cow by her first initial — an uppercase letter from to .

The cows have recently become fascinated by tic-tac-toe, but since they do not like the fact that only two cows can play at a time, they have invented a variant in which many cows can play at once! Just like regular tic-tac-toe, the game is played on a 3 \times 3 board, but instead of only 's and 's, each square is marked with a single uppercase letter — the initial of the cow who claims that square.

Here is an example of a game board:

COW
XXO
ABC

The cows fill in all squares before realizing that they are confused about how to determine who has won the game. Clearly, just like in regular tic-tac-toe, if a single cow has claimed an entire row, column, or diagonal, that cow can claim victory by herself. However, since the cows think this is unlikely given the larger number of players, they decide to allow teams of two cows. A team of two cows can claim victory if some row, column, or diagonal consists only of the letters of the two cows on the team, and the letters of both cows (not just one of them) appear in this row, column, or diagonal.

Help the cows determine how many individual cows and how many two-cow teams can claim victory. Note that the same square of the board may be used in several different claims to victory.

Input

Consists of three lines, each containing three uppercase letters from to .

Output

Print two lines. In the first line, print the number of individual cows that can claim victory. In the second line, print the number of two-cow teams that can claim victory.

Examples

In this example, no single cow can claim victory. However, if cows and team up, they can win via the C - X- C diagonal. Also, if cows and team up, they can win via the middle row.

Example 1

Loading
Loading