#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int h, w;
cin >> h >> w;
vector<string> arr(h);
for (int i = 0; i < h; ++i) {
cin >> arr[i];
}
bool found_r = false;
bool found_f = false;
for (int i = 0 ; i < h; ++i) {
for (auto &c : arr[i]) {
if (c == 'R') {
found_r = true;
} else if (c == 'F') {
found_f = true;
}
if (found_r && found_f) {
break;
}
}
}
if (found_r && found_f) {
cout << 2 << endl;
} else if (found_r || found_f) {
cout << 1 << endl;
} else {
cout << 0 << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |