Grid and phrase
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
You are given an grid which contains lower case English letters. How many times does the phrase "saba" appear horizontally, vertically, and diagonally in the grid?
The following word locations in the matrix are possible:
Input
The first line contains the number of rows and the number of columns in the grid. Each of the next lines contains a string of length whith lower case English letters only.
Output
Print the number of times the word "saba" appears in the grid.
Examples
Input #1
Answer #1
Submissions 606
Acceptance rate 39%