自己改了2个小时了,还是不行
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdbool.h>
char s[100001];
void score( int n);
int main() {
int i = 0;
while (scanf("%c",&s[i]) && s[i] != 'E') {
i++;
}
s[i] = '\0';
score( 11);
printf("\n\n");
score(22);
return 0;
}
void score(int n) {
int len = strlen(s);
int w = 0, l = 0;
for (int i = 0; i<len; i++) {
if (s[i] == 'W')
w++;
else if(s[i]=='L')
l++;
if ((w >= n && abs(w - l) >= 2) || (l >= n && abs(l - w) >= 2)) {
printf("%d:%d\n",w,l);
w = l = 0;
}
}
printf("%d:%d",w,l);
}