wjc007 @ 2024-12-10 18:48:48
# include <iostream>
using namespace std;
void fenzhi11(char * a)
{
int i,count1 = 0,count2 = 0;
for (i = 0;i<1000000;i++)
{
if (((count1 >= 11) || (count2 >= 11)) && (count1 - count2 >= 2 || count2 - count1 >= 2))
{
printf("%d:%d\n",count1,count2);
count1 = 0;
count2 = 0;
}
if (a[i] == 'W')
count1++;
else if (a[i] == 'L')
count2++;
}
if ((count1 != 0) || (count2 != 0))
printf("%d:%d\n",count1,count2);
return;
}
void fenzhi21(char * a)
{
int i,count1 = 0,count2 = 0;
for (i = 0;i<1000000;i++)
{
if (((count1 >= 21) || (count2 >= 21)) && (count1 - count2 >= 2 || count2 - count1 >= 2))
{
printf("%d:%d\n",count1,count2);
count1 = 0;
count2 = 0;
}
if (a[i] == 'W')
count1++;
else if (a[i] == 'L')
count2++;
}
if ((count1 != 0) || (count2 != 0))
printf("%d:%d\n",count1,count2);
return;
}
int main()
{
int i,count1 = 0,count2 = 0;
char a[1000000] = {'A'};
char t;
for (i = 0;cin >> t && t != 'E';i++)//循环输入直到读入'E'
{
a[i] = t;
}
fenzhi11(a);
if(a[0] == 'A')
printf("%d:%d\n",count1,count2);
printf("\n");
fenzhi21(a);
if(a[0] == 'A')
printf("%d:%d",count1,count2);
return 0;
}