This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
n,m=list(map(int,input().split()))
s=[]
for i in range(n):
s.append(list(input()))
c=0
for i in range(n):
for j in range(m-2):
if s[i][j]=="R" and s[i][j+1]=="G" and s[i][j+2]=="W":
c+=1
s[i][j]=""
s[i][j+1]=""
s[i][j+2]=""
for i in range(n-2):
for j in range(m):
if s[i][j]=="R" and s[i+1][j]=="G" and s[i+2][j]=="W":
c+=1
s[i][j]=""
s[i+1][j]=""
s[i+2][j]=""
print(c)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |