#include <bits/stdc++.h>
using namespace std;
void work(string str, int score)
{
int a = 0, b = 0;
for (int i = 0; i < str.size() && str[i] != 'E'; i ++ )
{
if (str[i] == 'W')
a ++ ;
else
b ++ ;
if (max(a, b) >= score && abs(a - b) >= 2)
{
cout<<a<<":"<<b<<endl;
a = b = 0;
}
}
cout<<a<<":"<<b<<endl;
}
int main()
{
string str, s;
while (cin >> s)
str += s;
work(str, 11);
cout<<endl;
work(str, 21);
return 0;
}
头尾用```括起来效果更好
thank you