Crossword
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
You are given a square crossword puzzle of size NxN. In this puzzle, empty cells are represented by the symbol '-', while filled cells are represented by the symbol '#'. According to the rules of crosswords, each word must be at least 2 letters long.
Your task is to count the number of words that appear horizontally and vertically in the crossword.
Input
The first line contains the integer N (1 ≤ N ≤ 2000), which represents the size of the crossword. The following N
lines each contain N
characters, consisting of '-' and '#', as described above.
Output
Print two numbers: the first is the count of words found horizontally, and the second is the count of words found vertically.
Examples
Input #1
Answer #1
Submissions 731
Acceptance rate 35%