| Task: | Peli |
| Sender: | Mahtimursu |
| Submission time: | 2020-11-06 18:50:15 +0200 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 35 |
| #2 | ACCEPTED | 65 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | 1, 2 | details |
| #2 | ACCEPTED | 0.01 s | 2 | details |
Code
#include <bits/stdc++.h>
typedef long long ll;
#define M 1000000007
using namespace std;
void test_case() {
string s;
cin >> s;
int p1 = -1, p2 = 0;
int n = (int)s.length();
for (int i = 0; i < n; i++) {
if (s[i] == 'P') {
if (p1 != -1) p2 = i;
else p1 = i;
}
}
if ((p2 - p1) & 1) {
cout << 2;
} else {
cout << 1;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
for (int i = 0; i < t; ++i) {
test_case();
cout << "\n";
//cout << endl;
}
return 0;
}