yanda25 @ 2024-07-28 10:07:48
#include <iostream>
#include <cmath>
using namespace std;
char a;
int cnt_11_a,cnt_11_b,cnt_21_a,cnt_21_b,cnt_21[10000000][2],cnt_21_;
bool k_11,k_21;
int main(){
while(cin >> a){
if(a == 'E'){
cout << cnt_11_a << ':' << cnt_11_b << endl << endl;
cnt_21[cnt_21_][0] = cnt_21_a;
cnt_21[cnt_21_][1] = cnt_21_b;
cnt_21_++;
break;
}
if(a == 'W'){
cnt_11_a++;
cnt_21_a++;
}
else if(a == 'L'){
cnt_11_b++;
cnt_21_b++;
}
if(cnt_11_a + cnt_11_b == 11 || k_11 == 1){
if(abs(cnt_11_a - cnt_11_b) >= 2){
cout << cnt_11_a << ':' << cnt_11_b << endl;
cnt_11_a = 0;
cnt_11_b = 0;
k_11 = 0;
}else {
k_11 = 1;
}
}
if(cnt_21_a + cnt_21_b == 21 || k_21 == 1){
if(abs(cnt_21_a - cnt_21_b) >= 2){
//cout << cnt_21_a << ':' << cnt_21_b << endl;
cnt_21[cnt_21_][0] = cnt_21_a;
cnt_21[cnt_21_][1] = cnt_21_b;
cnt_21_++;
cnt_21_a = 0;
cnt_21_b = 0;
k_21 = 0;
}else {
k_21 = 1;
}
}
}
for(int i = 0;i < cnt_21_;i++){
cout << cnt_21[i][0] << ':' << cnt_21[i][1] << endl;
}
return 0;
}