You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
581 B

#include <bits/stdc++.h>
using namespace std;
void solve(string str, int score) {
int a = 0, b = 0;
for (int i = 0; i < str.size(); i++) {
if (str[i] == 'E') break;
if (str[i] == 'W')
a++;
else
b++;
if (max(a, b) >= score && abs(a - b) >= 2) {
printf("%d:%d\n", a, b);
a = b = 0;
}
}
printf("%d:%d\n", a, b);
}
int main() {
string str, s;
while (cin >> s) str += s;
solve(str, 11);
puts("");
solve(str, 21);
return 0;
}