atcoder#ABC275C. [ABC275C] Counting Squares

[ABC275C] Counting Squares

Score : 300300 points

Problem Statement

There is a two-dimensional plane. For integers rr and cc between 11 and 99, there is a pawn at the coordinates (r,c)(r,c) if the cc-th character of SrS_{r} is #, and nothing if the cc-th character of SrS_{r} is ..

Find the number of squares in this plane with pawns placed at all four vertices.

Constraints

  • Each of S1,,S9S_1,\ldots,S_9 is a string of length 99 consisting of # and ..

Input

The input is given from Standard Input in the following format:

S1S_1

S2S_2

\vdots

S9S_9

Output

Print the answer.

##.......
##.......
.........
.......#.
.....#...
........#
......#..
.........
.........
2

The square with vertices (1,1)(1,1), (1,2)(1,2), (2,2)(2,2), and (2,1)(2,1) have pawns placed at all four vertices.

The square with vertices (4,8)(4,8), (5,6)(5,6), (7,7)(7,7), and (6,9)(6,9) also have pawns placed at all four vertices.

Thus, the answer is 22.

.#.......
#.#......
.#.......
.........
....#.#.#
.........
....#.#.#
........#
.........
3