17 lines
429 B
Python
17 lines
429 B
Python
|
import sys, os
|
||
|
|
||
|
L = sys.stdin.read().strip().split("\n")
|
||
|
G = [list(l) for l in L]
|
||
|
H = len(G)
|
||
|
W = len(G[0])
|
||
|
|
||
|
S = 0
|
||
|
for i in range(1,H-1): # rows
|
||
|
for j in range(1, W-1): # cols
|
||
|
if G[i][j] == "A":
|
||
|
for P in ["MMSS", "SMMS", "SSMM", "MSSM"]:
|
||
|
if G[i-1][j-1] == P[0] and G[i-1][j+1] == P[1] \
|
||
|
and G[i+1][j+1] == P[2] and G[i+1][j-1] == P[3]:
|
||
|
S+=1
|
||
|
print(S)
|