| Task: | Peli |
| Sender: | Laakeri |
| Submission time: | 2020-11-06 22:50:14 +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;
int main() {
int tcs;
cin>>tcs;
for (int i=0;i<tcs;i++){
string s;
cin>>s;
int x=-1;
int y=-1;
for (int j=0;j<(int)s.size();j++){
if (s[j]=='P'){
if (x>=0) {
y=j;
} else {
x=j;
}
}
}
cout<<(y-x)%2+1<<endl;
}
}