洛谷 P1042 乒乓球
var s:string; a1:array[1..50000] of char; i,n,x,y:longint; procedure f1; begin while not eof do begin readln(s); for i:=1 to length(s) do begin if s[i]='E' then exit; inc(n); a1[n]:=s[i]; end; end; end; begin f1; for i:=1 to n do begin if a1[i]='W' then inc(x) else inc(y); if ((x>=11) or (y>=11)) and (abs(x-y)>=2) then begin writeln(x,':',y); x:=0;y:=0; end; end; writeln(x,':',y); writeln; x:=0;y:=0; for i:=1 to n do begin if a1[i]='W' then inc(x) else inc(y); if ((x>=21) or (y>=21)) and (abs(x-y)>=2) then begin writeln(x,':',y); x:=0;y:=0; end; end; writeln(x,':',y); end.