Task: | Peli |
Sender: | jnalanko |
Submission time: | 2020-11-08 21:16:15 +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; typedef long long LL; int main(){ LL t; cin >> t; while(t--){ string S; cin >> S; LL l = 0; while(S[l] != 'P') l++; LL r = S.size()-1; while(S[r] != 'P') r--; cout << 2 - (r-l-1) % 2 << "\n"; } }