求助 只有40分
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
char c;
string s;
//将所有字符放在一个string中
while(true) {
cin >> c;
s += c;
if(c == 'E') break;
}
// q为出现了多少次W i是循环次数
int q = 0,i = 0;
for(i = 0;;i++) {
c = s[i];
if(c == 'W')
q++;
if(i%11 == 10){
cout << q << ":" << 11 - q << endl;
q = 0;
}
if(c == 'E')
break;
}
cout << q << ":" << i%11 - q << endl;
cout << endl;
q = 0;
i = 0;
for(i = 0;;i++) {
c = s[i];
if(c == 'W')
q++;
if(i%21 == 20){
cout << q << ":" << 21 - q << endl;
q = 0;
}
if(c == 'E')
break;
}
cout << q << ":" << i%21 - q << endl;
return 0;
}