#include <bits/stdc++.h>
#define rep(a,b,c) for(auto a = (b); a != (c); a++)
#define repD(a,b,c) for(auto a = (b); a != (c); a--)
#define repIn(a, b) for(auto& a : (b))
#define repIn2(a, b, c) for(auto& [a, b] : (c))
constexpr bool dbg = 1;
#define DEBUG if constexpr(dbg)
#define DC DEBUG std::cerr
#define eol std::endl
#define ll long long
#define pb push_back
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
vector<string> xd;
int h, w;
cin >> h >> w;
xd.resize(h);
rep(i, 0, h) cin >> xd[i];
int ans = 0;
rep(i, 0, h) rep(j, 0, w) ans += ((i + 2 < h && xd[i][j] == 'R' && xd[i + 1][j] == 'G' && xd[i + 2][j] == 'W') || (j + 2 < w && xd[i][j] == 'R' && xd[i][j + 1] == 'G' && xd[i][j + 2] == 'W'));
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |