Task: | Peli |
Sender: | AtskaFin |
Submission time: | 2020-11-06 18:25:04 +0200 |
Language: | C++ (C++17) |
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 <iostream>#include <string>using namespace std;int main() {int t; cin >> t;for (int i = 0; i < t; i++) {string x; cin >> x;int f = 0, len = x.size(), c = 0;for (int i = 0; i < len; i++) {if (x[i] == 'P') {if (!f) f = 1;else break;} else if (f) {c++;}}cout << (c%2==0?2:1) << "\n";}}