Task: | Peli |
Sender: | mangolassi |
Submission time: | 2020-11-08 08:08:22 +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>using namespace std;using ll = long long;int main() {ios_base::sync_with_stdio(false);cin.tie(0);int t;cin >> t;for (int ti = 0; ti < t; ++ti) {string str;cin >> str;int n = str.size();int a = n, b = 0;for (int i = 0; i < n; ++i) {if (str[i] == 'P') {a = min(a, i);b = max(b, i);}}if ((b - a) & 1) cout << 2 << '\n';else cout << 1 << '\n';}}