378 条题解
-
0HBat LV 8 @ 2016-09-23 01:39:29
最后一个运行出错,why???
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>using namespace std;
int main()
{char so[20]={' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',};
long int i;
long long int a,b;
vector <int> a11;
vector <int> b11;
vector <int> a21;
vector <int> b21;
vector <char> sm;
while( gets(so) )
{
for(i=0;i<20;++i)
{
if(so[i]=='E')goto A1;
else if(so[i]==' ')continue;
else sm.push_back(so[i]);
}
}
A1:;
int len=sm.size();
for(i=0;i<len;)
{
a=0;
b=0;
while(a<11&&b<11&&i<len)
{
if(sm[i]=='W')a++;
else b++;
++i;
}
while( abs(a-b)<=1&&i<len )
{
if(sm[i]=='W')a++;
else b++;
++i;
}
a11.push_back(a);
b11.push_back(b);
}
if( ( (a==11)||(b==11) )||( ( (a>11)||(b>11) )&&( abs(a-b)>1 ) ) )
{
a11.push_back(0);
b11.push_back(0);
}
for(i=0;i<len;)
{
a=0;
b=0;
while(a<21&&b<21&&i<len)
{
if(sm[i]=='W')a++;
else b++;
++i;
}
while( abs(a-b)<=1&&i<len )
{
if(sm[i]=='W')a++;
else b++;
++i;
}
a21.push_back(a);
b21.push_back(b);
}
if( ( (a==21)||(b==21) )||( ( (a>21)||(b>21) )&&( abs(a-b)>1 ) ) )
{
a21.push_back(0);
b21.push_back(0);
}
int lenq=a11.size();
if(lenq==0)cout<<"0:0\n";
for(i=0;i<lenq;++i)
{
cout<<a11[i]<<':'<<b11[i]<<endl;
}
cout<<endl;
lenq=a21.size();
if(lenq==0)cout<<"0:0\n";
for(i=0;i<lenq;++i)
cout<<a21[i]<<':'<<b21[i]<<endl;
} -
02016-09-21 11:52:56@
program v1217;
var
ch:char;
c11,c21:array[0..1,1..10000] of integer;
i,i11,i21:integer;
begin
i11:=1;i21:=1;
fillchar(c11,sizeof(c11),0);
fillchar(c21,sizeof(c21),0);
repeat
read(ch);
if ch='W' then begin inc(c11[0,i11]); inc(c21[0,i21]); end;
if ch='L' then begin inc(c11[1,i11]); inc(c21[1,i21]); end;
if ((c11[0,i11]>=11)or(c11[1,i11]>=11))and (abs(c11[0,i11]-c11[1,i11])>=2)then inc(i11);
if ((c21[0,i21]>=21)or(c21[1,i21]>=21))and (abs(c21[0,i21]-c21[1,i21])>=2)then inc(i21);
until ch='E';
for i:=1 to i11 do writeln(c11[0,i],':',c11[1,i]);
writeln;
for i:=1 to i21 do writeln(c21[0,i],':',c21[1,i]);
end.
{模拟字符串处理
本题需要处理的几个问题:
1.如何处理输入?
因为必须对每一个字符进行判断,所以选择逐个输入字符并马上做判断处理。输入结束以‘E’字符出现为标志。采用repeat..until循环实现
2.如何判断一局的结束?
认真思考分析后不难得知,只要双方有一人达到赛制规定的得分数(11分制的得分>=11,21分制的得分>=21),且双方的分差超过2即可分出胜负。
3.如何输出?
分析输出格式发现必须先记录所有的比赛结果后才能输出。且需要输出比分,所以采用二维数组记录比赛结果
4.特别指出
本题坑爹的地方在于题干说“比赛规则和实际比赛规则相同”,因此笔者善良地以为最多只有五局。结果造成一般数据超时。后来扩大局数,轻松AC!
} -
02016-08-28 18:20:58@
###**STL大法**
```c++
评测结果
编译成功foo.cpp: In function 'int main()':
foo.cpp:25:12: warning: array subscript is above array bounds [-Warray-bounds]
t[tmp][2] = cnt21['L'];
^
foo.cpp:31:64: warning: array subscript is above array bounds [-Warray-bounds]
for (int i = 1;i <= tmp;i++) cout << t[i][1] << ':' << t[i][2] << '\n';
^
测试数据 #0: Accepted, time = 15 ms, mem = 1336 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 1344 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 1352 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 1352 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 1348 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 1348 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 1348 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 1348 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 1336 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 1348 KiB, score = 10
Accepted, time = 15 ms, mem = 1352 KiB, score = 100
代码
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
//ifstream cin("table.in",ios :: in);
//ofstream cout("table.out",ios :: out);
int main() {
ios :: sync_with_stdio(false);
char ch;
map <char,int> cnt11,cnt21;
int tmp = 0,t[100001][2];
while (cin >> ch) {
if (ch == 'E') break;
if (ch != '\n') {
cnt11[ch]++;
cnt21[ch]++;
}
if ((cnt11['W'] >= 11 || cnt11['L'] >= 11) && abs(cnt11['W']-cnt11['L']) >= 2) {
cout << cnt11['W'] << ':' << cnt11['L'] << '\n';
cnt11['W'] = 0;
cnt11['L'] = 0;
}
if ((cnt21['W'] >= 21 || cnt21['L'] >= 21) && abs(cnt21['W']-cnt21['L']) >= 2) {
t[++tmp][1] = cnt21['W'];
t[tmp][2] = cnt21['L'];
cnt21['W'] = 0;
cnt21['L'] = 0;
}
}
cout << cnt11['W'] << ':' << cnt11['L'] << "\n\n";
for (int i = 1;i <= tmp;i++) cout << t[i][1] << ':' << t[i][2] << '\n';
cout << cnt21['W'] << ':' << cnt21['L'];
return 0;
}
``` -
02016-08-19 20:32:46@
var
s:ansistring;
i,j,m,n:longint;
c:char;
begin
s:='';
repeat
read(c);
if (c='W') or (c='L') then s:=s+c;
until c='E';
m:=0;
n:=0;
for i:=1 to length(s) do
begin
if s[i]='W' then inc(m) else inc(n);
if ((m>=11) or (n>=11)) and(abs(m-n)>=2) then
begin
writeln(m,':',n);
m:=0;
n:=0;
end;
end;
writeln(m,':',n);
m:=0;
n:=0;
writeln;
for i:=1 to length(s) do
begin
if s[i]='W' then inc(m) else inc(n);
if ((m>=21) or (n>=21)) and(abs(m-n)>=2) then
begin
writeln(m,':',n);
m:=0;
n:=0;
end;
end;
writeln(m,':',n);
end.
最后一次0:0也输出外面直接输mn就行 -
02016-08-14 21:18:10@
#include <iostream> #include <cmath> #include <algorithm> using namespace std; int a1=0,b1=0,a2=0,b2=0,i=0,t=0,a[100001],b[100001]; int main(){ char chr; while (cin >> chr){ if (chr=='E') break; i++; if (chr=='W') { a1++; a2++; } if (chr=='L') { b1++; b2++; } if ((a1>=11 || b1>=11) && (abs(a1-b1)>=2)){ //对于11分制的直接输出 cout << a1 << ":" << b1 << endl; a1=0; b1=0; } if ((a2>=21||b2>=21)&&((a2-b2)>=2||(b2-a2)>=2)){ a[++t]=a2; b[t]=b2; a2=0; b2=0; } } if (i==0) { //专门针对第一个字符就是E的情况 cout << "0:0" << endl << endl << "0:0" << endl; return 0; } cout << a1 << ":" << b1 << endl << endl; //11分制最后一局 for (i=1; i<=t; i++) cout << a[i] << ":" << b[i] << endl; //21分制 if (a2!=0 || b2!=0) cout << a2 << ":" << b2 << endl << endl; //21分制最后一局 }
-
02016-08-13 14:57:16@
var ans1,ans2,i,n:longint; c:array[1..1000000]of char; ch:char; begin repeat read(ch); inc(n); if (ch='W')or(ch='L') then c[n]:=ch; until ch='E'; for i:=1 to n do begin if c[i]='W' then inc(ans1); if c[i]='L' then inc(ans2); if (abs(ans1-ans2)>=2)and((ans1>10)or(ans2>10)) then begin writeln(ans1,':',ans2);ans1:=0;ans2:=0;end; end; writeln(ans1,':',ans2); ans1:=0; ans2:=0; writeln; for i:=1 to n do begin if c[i]='W' then inc(ans1); if c[i]='L' then inc(ans2); if (abs(ans1-ans2)>=2)and((ans1>20)or(ans2>20)) then begin writeln(ans1,':',ans2);ans1:=0;ans2:=0;end; end; writeln(ans1,':',ans2); end.
-
02016-08-07 18:59:07@
#include<cstdio> #include<cstring> #include<iostream> #include<cmath> #include<algorithm> using namespace std; typedef long long ll; const int MAXX=1000001; string s; int sum=0; int a[MAXX][2],b[MAXX][2],tot1,tot2; int main() { freopen("data.in","r",stdin); ios::sync_with_stdio(0); while(cin>>s) { for(int i=0;i<int(s.size());i++) { if(max(a[tot1][1],a[tot1][0])>=11) if(abs(a[tot1][1]-a[tot1][0])>=2) { tot1++; } if(max(b[tot2][1],b[tot2][0])>=21) if(abs(b[tot2][1]-b[tot2][0])>=2) tot2++; if(s[i]=='W') { a[tot1][1]++; b[tot2][1]++; } else if(s[i]=='L') { a[tot1][0]++; b[tot2][0]++; } else { goto sc; } } } sc: for(int i=0;i<=tot1;i++) { cout<<a[i][1]<<":"<<a[i][0]<<endl; } cout<<endl; for(int i=0;i<=tot2;i++) { cout<<b[i][1]<<":"<<b[i][0]<<endl; } }
-
02016-07-17 16:03:34@
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;int main()
{
int i=0,m=0,n=0,j;
char a[100001];//范围太大不行,太小也不行
do
{
i++;
scanf("%c",&a[i]);
}while(a[i] != 'E');
for(i=1;a[i] != 'E';i++)
{
if(a[i]=='W')
m++;
else if(a[i] == 'L')
n++;
else if(a[i] == '\n')
continue;
else if(a[i] == 'E')
break;
if((m>=11||n>=11)&&(m-n>=2||n-m>=2))//如果胜利,就直接输出,说明这一局已经结束了
{
printf("%d:%d\n", m, n);
m=0;
n=0;
}//用括号括起来 不然不管输出与否 都会清零
}
printf("%d:%d\n", m, n);//不管胜利与否 都输出 清零
m=0;
n=0;
for(i=1;a[i] != 'E';i++)
{
if(a[i]=='W')
m++;
else if(a[i] == 'L')
n++;
else if(a[i] == ' ')
continue;
else if(a[i] == 'E')
break;
if((m>=21||n>=21)&&(m-n>=2||n-m>=2))
{
printf("%d:%d\n", m, n);
m=0;
n=0;
}
}
printf("%d:%d\n", m, n);
return 0;
} -
02016-07-13 15:36:44@
0:0
```c++
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>char a[1000000];
int main(){
// freopen("in.txt","r",stdin);
int n=0;
while(scanf(" %c",&a[n])==1)
n++;
n--;
int p1,p2,st=0;
for(int i=0;i<n;i++){
if(a[i]=='E')
break;if(st==0)
st=1,p1=p2=0;if(a[i]=='W')
p1++;
else
p2++;if(p1<11&&p2<11)
continue;
if((p1>=11||p2>=11)&&abs(p1-p2)>=2){
st=0;
printf("%d:%d\n",p1,p2);
}
}
if(st)
printf("%d:%d\n\n",p1,p2);
if(!st)
printf("0:0\n\n");st=0;
for(int i=0;i<n;i++){
if(a[i]=='E')
break;if(st==0)
st=1,p1=p2=0;if(a[i]=='W')
p1++;
else
p2++;if(p1<21&&p2<21)
continue;
if((p1>=21||p2>=21)&&abs(p1-p2)>=2){
st=0;
printf("%d:%d\n",p1,p2);
}
}
if(st)
printf("%d:%d",p1,p2);
if(!st)
printf("0:0");return 0;
}
``` -
02016-07-11 00:05:11@
由于智商低下,没有输出0:0,白交了三次。
```
#include<iostream>
#include<cmath>
#include<string>
using namespace std;int main(){
string s1,s2;
while(getline(cin,s2))s1+=s2;
int i = 0;
int a=0,b=0;
while(s1[i]!='E'){
switch(s1[i]){
case 'W' :a++;break;
case 'L' :b++;break;
}
if((a>=11||b>=11)&&abs(a-b)>=2){
cout<<a<<':'<<b<<endl;
a = b = 0;
}
i++;
}
cout<<a<<':'<<b<<endl;
cout<<endl;
i = 0,a = 0,b = 0;
while(s1[i]!='E'){
switch(s1[i]){
case 'W' :a++;break;
case 'L' :b++;break;
}
if((a>=21||b>=21)&&abs(a-b)>=2){
cout<<a<<':'<<b<<endl;
a = b = 0;
}
i++;
}
cout<<a<<':'<<b<<endl;
return 0;
}
``` -
02016-06-30 17:23:14@
#include<iostream> #include<cstdio> #include<string> #include<algorithm> using namespace std; int m; int w, l; string s; void solve (int k) { char c; w = l = 0; for (int i = 0; i < m; i++) { c = s[i]; if (c == 'W') w++; else l++; if (w < k && l < k) continue; else if (abs(w-l) > 1) { cout << w << ":" << l << "\n"; w = l = 0; } } cout << w << ":" << l << "\n\n"; } int main () { //freopen ("in.txt", "r", stdin); char c; while (cin >> c) { if (c == 'L' || c == 'W') s += c; if (c == 'E') break; } m = s.length(); solve(11); solve(21); return 0; }
-
02016-06-23 13:32:27@
C++
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
char s[100000],s1[100];
int lens,wwin,lwin,ci,ci2,g=1,len;
while(g==1)
{
gets(s1);
len=strlen(s1);
for(int i=0;i<=len-1;i++)
{
if(s1[i]=='E')g=2;
}
strcat(s,s1);
}
lens=strlen(s);
wwin=0;
lwin=0;
ci=1;
ci2=1;
for(int i=0;i<=lens-1;i++)
{
if((wwin>=11||lwin>=11) && abs(wwin-lwin)>=2)
{
cout<<wwin<<":"<<lwin<<endl;
wwin=0;lwin=0;ci=1;
}
if(s[i]=='W')wwin++;
if(s[i]=='L')lwin++;
// ci++;
if(s[i]=='E')
{
// if(wwin!=0 && lwin!=0)
// {
cout<<wwin<<":"<<lwin<<endl;
// }
wwin=0;lwin=0;ci=1;
}
if(s[i]=='E')break;
}
cout<<endl;
for(int i=0;i<=lens-1;i++)
{
if((wwin>=21||lwin>=21) && abs(wwin-lwin)>=2)
{
cout<<wwin<<":"<<lwin<<endl;
wwin=0;lwin=0;ci=1;
}
if(s[i]=='W')wwin++;
if(s[i]=='L')lwin++;
// ci++;
if(s[i]=='E')
{
// if(wwin!=0 && lwin!=0)
// {
cout<<wwin<<":"<<lwin<<endl;
// }
wwin=0;lwin=0;ci=1;
}
if(s[i]=='E')break;
}
} -
02016-05-20 11:38:34@
模拟题。思路:用一个string存起来所有的结果然后两次遍历即可。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;string s;
int main(){
char get;
while(scanf("%c",&get) && get!='E'){
if(get=='W' || get=='L')
s.push_back(get);
}int op=0,se=0;
for(int i=0;i<s.length();i++){
if(s[i]=='W') se++;
else op++;if(op>=11 && op-2>=se){
printf("%d:%d\n",se,op);
op = 0;
se = 0;
}else if(se>=11 && se-2>=op){
printf("%d:%d\n",se,op);
op = 0;
se = 0;
}
}
printf("%d:%d\n",se,op);
cout<<endl;op=0;se=0;
for(int i=0;i<s.length();i++){
if(s[i]=='W') se++;
else op++;if(op>=21 && op-2>=se){
printf("%d:%d\n",se,op);
op = 0;
se = 0;
}else if(se>=21 && se-2>=op){
printf("%d:%d\n",se,op);
op = 0;
se = 0;
}
}
printf("%d:%d\n",se,op);return 0;
} -
02016-05-18 20:36:02@
小田君又来发题解了~~~
模拟题,秒过。附代码:
#include <stdio.h>int main(){
// freopen("Table.in","r",stdin);
// freopen("Table.out","w",stdout);
int i = 0,c = 0,d = 0,x = 0,y = 0,cnt;
char F[100001],a;
scanf("%c",&a);
while(a != 'E'){
F[i] = a;
if(a == 'W') c++;
else if(a == 'L') d++;
if((c >= 11&&c-d >= 2)||(d >= 11&&d-c >= 2)){
printf("%d:%d\n",c,d);
c = 0,d = 0;
}
i++;
scanf("%c",&a);
}
printf("%d:%d\n\n",c,d);
for(cnt = 0; cnt < i; cnt++){
if(F[cnt] == 'W') x++;
else if(F[cnt] == 'L') y++;
if((x >= 21&&x-y >= 2)||(y >= 21&&y-x >= 2)){
printf("%d:%d\n",x,y);
x = 0,y = 0;
}
}
printf("%d:%d\n\n",x,y);return 0;
} -
02016-04-23 14:36:47@
//思路:11分制、21分制比分分别用不同数组储存,字符用一个s记录,不储存。
//然后模拟。k和kk分别记录11分制、21分制下的局数。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
char s;
int p(0);
bool pp=1;
int huahua[10005],niuniu[10005],ss,hh[10005],nn[10005],k(1),kk(1);
int main()
{
s=getchar();
p++;
if(s=='W')
{
huahua[k]++;
hh[kk]++;
}
else
if(s=='L')
{
niuniu[k]++;
nn[kk]++;
}
while(s!='E'&&pp==1)
{
if(p==20)
{
getchar();
p=0;
}
p++;
s=getchar();
if(s=='W')
{
huahua[k]++;
hh[kk]++;
}
else
if(s=='L')
{
niuniu[k]++;
nn[kk]++;
}
if(huahua[k]==11&&niuniu[k]<=9)
{
k++;
}
else
if(huahua[k]<=9&&niuniu[k]==11)
{
k++;
}
else
if(huahua[k]>=10&&niuniu[k]>=10)
{
if(huahua[k]-niuniu[k]==2)
k++;
else
if(niuniu[k]-huahua[k]==2)
k++;
}
if(hh[kk]==21&&nn[kk]<=19)
{
kk++;
}
else
if(hh[kk]<=19&&nn[kk]==21)
{
kk++;
}
else
if(hh[kk]>=20&&nn[kk]>=20)
{
if(hh[kk]-nn[kk]==2)
kk++;
else
if(nn[kk]-hh[kk]==2)
kk++;
}
}
if(s=='E')
{
for(int i=1;i<=k;i++)
printf("%d:%d\n",huahua[i],niuniu[i]);
printf("\n");
for(int i=1;i<=kk;i++)
printf("%d:%d\n",hh[i],nn[i]);
printf("\n");
pp=0;
}
return 0;
} -
02016-04-16 21:05:42@
提交24次后的AC...新开一局0:0也要打印啊!!!
var ch:char;
i,j,n:longint;
w,l:integer;
s:ansistring;
begin
j:=0;
s:='';
repeat
inc(j);
if j mod 20=0 then readln(ch) else read(ch);
if (ch='W')or(ch='L')or(ch='E') then s:=s+ch;
until ch='E';
n:=length(s);w:=0;l:=0;i:=0;
for i:=1 to length(s) do
begin
if ((w>=11)and(w-l>1))or((l>=11)and(l-w>1)) then begin writeln(w,':',l);w:=0;l:=0;end;
if s[i]='E' then writeln(w,':',l);
if s[i]='W' then inc(w) else if s[i]='L' then inc(l);
end;
w:=0;l:=0;i:=0;
writeln;
for i:=1 to length(s) do
begin
if ((w>=21)and(w-l>1))or((l>=21)and(l-w>1))then begin writeln(w,':',l);w:=0;l:=0;end;
if s[i]='E' then writeln(w,':',l);
if s[i]='W' then inc(w) else if s[i]='L' then inc(l);
end;
end. -
02016-04-05 21:07:59@
#include <cstdio>
#include <cstring>
using namespace std;
#define cls(x,c) memset(x,c,sizeof(x))
#define fr(i,s,n) for (int i=s;i<=n;i++)
struct node {
int x,y;
}sore1[5000],sore2[5000];
int A1=0,B1=0,A2=0,B2=0,pos1=1,pos2=1;
int main()
{
char a;
cls(sore1,0); cls(sore2,0);
while(scanf("%c",&a) && a!='E')
{
if(a=='W') {A1++;A2++;} if(a=='L') {B1++;B2++;}
if(abs(A1-B1)>=2 && (A1>=11 || B1>=11))
{sore1[pos1].x=A1;sore1[pos1++].y=B1;A1=0;B1=0;}
if(abs(A2-B2)>=2 && (A2>=21 || B2>=21))
{sore2[pos2].x=A2;sore2[pos2++].y=B2;A2=0;B2=0;}
}
fr(i,1,pos1-1)
printf("%d:%d\n",sore1[i].x,sore1[i].y); printf("%d:%d\n\n",A1,B1);
fr(i,1,pos2-1)
printf("%d:%d\n",sore2[i].x,sore2[i].y); printf("%d:%d",A2,B2);
return 0;
} -
02016-03-20 12:58:48@
var
a,b:array[1..1000000]of longint;
i,j,k,c,d:longint;
x:char;
begin
x:=' ';k:=1;c:=0;d:=0;fillchar(a,sizeof(a),0);fillchar(b,sizeof(b),0);
while x<>'E' do
begin
read(x);
if x='E' then break;
if x='W' then begin inc(a[k]);inc(c); end;
if x='L' then begin inc(d); inc(b[k]); end;
if ((d>10) or (c>10)) and (abs(c-d)>1) then begin
writeln(c,':',d);c:=0;d:=0; end;
if ((a[k]>20) or (b[k]>20)) and (abs(a[k]-b[k])>1) then inc(k);
end;
writeln(c,':',d);
writeln;
for i:=1 to k do writeln(a[k],':',b[k]);
end.怎么错了,请大神指导 -
02016-03-14 17:14:07@
#include<iostream>
using namespace std;
long long t,i;
char s[1000000];
bool ok(int x,int y,int k)
{
if(x-y>=2 && x>=k)return 1;
if(y-x>=2 && y>=k)return 1;
return 0;
}void write(int k)
{
int i,x=0,y=0;
for(i=0;i<t;i++)
{
if(s[i]=='W')x++;
else y++ ;if(ok(x,y,k))
{
cout<<x<<':'<<y<<endl;
x=0,y=0;
}
}
cout<<x<<":"<<y;
}int main()
{
//freopen("p.in","r",stdin);
//freopen("p.out","w",stdout);
while(cin>>s[t],s[t]!='E')
if(s[t]=='W' || s[t]=='L') t++;write(11);
cout<<endl;
write(21);return 0;
}
//c++ -
02016-03-09 16:12:49@
#include<iostream>
using namespace std;
long long t,i;
char s[1000000];
bool ok(int x,int y,int k)
{
if(x-y>=2 && x>=k)return 1;
if(y-x>=2 && y>=k)return 1;
return 0;
}void write(int k)
{
int i,x=0,y=0;
for(i=0;i<t;i++)
{
if(s[i]=='W')x++;
else y++ ;if(ok(x,y,k))
{
cout<<x<<':'<<y<<endl;
x=0,y=0;
}
}
cout<<x<<":"<<y;
}int main()
{
while(cin>>s[t],s[t]!='E')
if(s[t]=='W' || s[t]=='L') t++;write(11);
cout<<endl;
write(21);return 0;
}