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 1089. Verification with the Dictionary

Can anyone tell me where is mistake?
Posted by Madiyar Tursunbayev 26 Dec 2005 02:23
I solved this problem, but my program is wrong at 4 test.
Where is mistake?

var
l,k,j,m,n,mistake,o,sum,p,w:integer;  text1:string;
z,text:array[1..100]of string;
begin  o:=1;
repeat
inc(l);
readln(z[l]);
until z[l]='#';
dec(l);
repeat
inc(j);
readln(text[j]);
until text[j]=''; dec(j);
for k:=1 to l do
for m:=1 to j do
 begin
for n:=1 to length(text[m]) do
begin      text1:='';
while text[m][o] in ['a'..'z'] do
begin
text1:=text1+text[m][o]; inc(o);
end;
if length(text1)=length(z[k]) then
 begin
for w:=1 to length(z[k]) do
if text1[w]<>z[k][w] then inc(mistake);
if mistake=1 then
 begin
 inc(sum);
 for p:=1 to length(z[k]) do
  begin
  text[m][o-length(text1)+p-1]:=z[k][p];
  end;
 end;
mistake:=0;
end;  inc(o);
end;
o:=1;
(*----------------------*)
end;
for k:=1 to j do
writeln(text[k]);
writeln(sum);
end.
Re: Can anyone tell me where is mistake?
Posted by Uran 30 Jan 2008 02:34
I also have WA 4. Does anybody know what is wrong with it?