|
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <cmath>
- #include <cstring>
- #include <algorithm>
- using namespace std;
- int main(){
- int i,a,b,M21=0,M11=0,L21=0,L11=0,g1=0,g2=0,print1[10000][3],print2[10000][3];
- char w;
- w=getchar();
- while(w!='E')
- {
- if(w=='W')
- {
- M21++;
- M11++;
- }
- else if(w=='L')
- {
- L21++;
- L11++;
- }
- if(M11>=11||L11>=11)
- {
- if(abs(M11-L11)>=2)
- {
- g1++;
- print1[g1][1]=M11;
- print1[g1][2]=L11;
- M11=L11=0;
- }
- }
- if(M21>=21||L21>=21)
- {
- if(abs(M21-L21)>=2)
- {
- g2++;
- print2[g2][1]=M21;
- print2[g2][2]=L21;
- M21=L21=0;
- }
- }
- w=getchar();
- }
- for(i=1;i<=g1;i++)
- {
- printf("%d:%d\n",print1[i][1],print1[i][2]);
- }
- printf("%d:%d\n\n",M11,L11);
- for(i=1;i<=g2;i++)
- {
- printf("%d:%d\n",print2[i][1],print2[i][2]);
- }
- printf("%d:%d",M21,L21);
- return 0;
- }
复制代码 |
|