#850
Silver II
TROJKE
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Mirko and Slavko are playing a new game, "Trojke" (Triplets). First they use a chalk to draw an N-by-N square grid on the road. Then they write letters into some of the squares. No letter is written more than once in the grid.

The game consists of trying to find three letters on a line as fast as possible. Three letters are considered to be on the same line if there is a line going through the centre of each of the three squares.

After a while it gets harder to find new triplets. Mirko and Slavko need a program that counts all the triplets, so that they know if the game is over or they need to search further.

입력

The first line contains an integer NN (3N1003 \le N \le 100), the dimension of the grid.

Each of the NN following lines contains NN characters describing the grid -- uppercase letters and the character '.', which marks an empty square.

출력

Output the number of triplets on a single line.

예제 입력 1

4
...D
..C.
.B..
A...

예제 출력 1

4

예제 입력 2

5
..T..
A....
.FE.R
....X
S....

예제 출력 2

3

예제 입력 3

10
....AB....
..C....D..
.E......F.
...G..H...
I........J
K........L
...M..N...
.O......P.
..Q....R..
....ST....

예제 출력 3

0
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver II1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.