ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1612. Tram Forum

Why WA on test 24?!
Posted by ilya_romanenko 27 May 2011 22:20
Please people help! Can anybody tell me test 24?

const
tr='tram';
trol='trolleybus';
mmm=' `~!@#$%^&*()-_=+\\|[{]};:\",<.>/?¹0123456789';
var
tr1,tr2,a,b,c,i:integer;
s:widestring;
begin
b:=1;
tr1:=0;
tr2:=0;
c:=0;
while(not seekEOF)do
begin
c:=0;
readln(s);
while(pos(tr,s)>0)do begin
c:=0;
for i:=1 to 45 do
if(s[pos(tr,s)+4]=mmm[i])then  inc(c);
if(pos(tr,s)+4=length(s))then inc(c);
if((ord(pos(tr,s)+4)=39)or(ord(pos(tr,s)+4)=96))then inc(c);
if(c=0)then begin
delete(s,pos(tr,s),4);
end
else begin inc(tr1);
delete(s,pos(tr,s),4);
end;
end;
c:=0;
while(pos(trol,s)>0)do begin
c:=0;
for i:=1 to 45 do
if(s[pos(trol,s)+10]=mmm[i])then  inc(c);
if(pos(trol,s)+10=length(s))then inc(c);
if((ord(pos(trol,s)+10)=39)or(ord(pos(trol,s)+10)=96))then inc(c);
if(c=0)then begin
delete(s,pos(trol,s),10);
end
else begin
inc(tr2);
delete(s,pos(trol,s),10);
end;
end;
inc(b);
end;
if(tr1>tr2)then writeln('Tram driver')
else if(tr2>tr1)then writeln('Trolleybus driver')
else if(tr2=tr1)then writeln('Bus driver');
end.

P.S. Sorry for bad English.

Edited by author 31.05.2011 00:05
Re: Why WA on test 24?!
Posted by ilya_romanenko 4 Sep 2011 20:32
Now is AC. Two small mistakes...