시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 6 6 5 100.000%

문제

테이블 위에 놓인 성냥개비를 생각해 보시오. 예시:

문제는 성냥개비들로 이루어지는 정사각형의 개수를 구하는 것이다. 예를 들어 위의 예시는 2개의 정사각형이 성냥개비로 이루어진다.

입력

입력은 여러 개의 배열로 이루어진다. 각 배열의 첫 번째 줄에는 열과 행의 수를 나타내는 두 개의 정수 r 과 c(1 ≤ r, c ≤ 20)가 주어진다. 그 뒤로는 성냥개비의 배열 상태를 나타내는 2r+1개의 줄이 주어진다. 배열을 나타내는 줄의 홀수 번째 줄은 c개의 문자로 이루어지며, 각각의 문자는 가로 방향으로 놓인 성냥개비를 나타내는 하이픈('–')과 빈 공간을 나타내는 별표('*') 둘 중 하나이다. 배열을 나타내는 짝수 번째 줄은 c+1개의 문자로 이루어지며, 각각의 문자는 세로 방향으로 놓인 성냥개비를 나타내는 막대('|')와 빈 공간을 나타내는 별표('*') 둘 중 하나이다. 0 0이 입력되면 입력이 종료된다.

출력

출력은 각 줄에 각 배열에서 이루어질 수 있는 정사각형의 수 뒤에 한 칸을 띄고 영어 단어 'squares'를 붙여 'X squares'와 같은 형식으로 출력해야 한다.

예제 입력 1

2 3
--*
|||*
*-*
|*||
---
2 2
--
|||
--
|||
--
0 0

예제 출력 1

2 squares
5 squares
W3sicHJvYmxlbV9pZCI6IjIyMTQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMxMzFcdWIwZTVcdWFjMWNcdWJlNDRcdWM2NDAgXHVjODE1XHVjMGFjXHVhYzAxXHVkNjE1IiwiZGVzY3JpcHRpb24iOiI8cD5cdWQxNGNcdWM3NzRcdWJlMTQgXHVjNzA0XHVjNWQwIFx1YjE5M1x1Yzc3OCBcdWMxMzFcdWIwZTVcdWFjMWNcdWJlNDRcdWI5N2MgXHVjMGRkXHVhYzAxXHVkNTc0IFx1YmNmNFx1YzJkY1x1YzYyNC4gXHVjNjA4XHVjMmRjO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