题目传送门
//P1042.cpp
#include <bits/stdc++.h>
using namespace std;
//每行至多 25 个字母,最多有 2500 行。
const int N = 25 * 2500 + 10;
int a[N];//小华的输赢状态表
int idx;
int main() {
char tmp;
while (true) {
cin >> tmp;
if (tmp == 'E') break;
if (tmp == 'W') a[idx++] = 1;
else if (tmp == 'L')a[idx++] = 0;
}
//开始分析11分
int w = 0, l = 0;
for (int i = 0; i < idx; i++) {
if (a[i])w++; else l++;
if ((w >= 11 || l >= 11) && abs(w - l) >= 2) {
cout << w << ":" << l << endl;
//下一局开始,清零
w = l = 0;
}
}
cout << w << ":" << l << endl;
//两种计分制中间需要有空行
cout<<endl;
//开始分析21分
w = 0, l = 0;
for (int i = 0; i < idx; i++) {
if (a[i])w++; else l++;
if ((w >= 21 || l >= 21) && abs(w - l) >= 2) {
cout << w << ":" << l << endl;
//下一局开始,清零
w = l = 0;
}
}
cout << w << ":" << l << endl;
return 0;
}