|
|
вернуться в форумWho my program always got wrong?Must the last empty line be output? Послано hydra 17 окт 2001 13:31 const maxn=100; maxl=8; type words=string[maxl]; var vocabulary:array [1..maxn] of words; mispell,i,n,l,k,s:byte; bf:char; now:words; mistake:word; procedure judge; begin if l>0 then begin now[0]:=char(l);s:=0; for i:=1 to n do if l=byte(vocabulary[i,0]) then begin mispell:=0; for k:=1 to l do if now[k]<>vocabulary[i,k] then begin inc(mispell); if mispell>1 then break; end; if mispell=0 then begin s:=0;break;end else if mispell=1 then s:=i; end; if s=0 then write(now) else begin write(vocabulary[s]); inc(mistake); end; l:=0; end;{if} end; begin n:=1; readln(vocabulary[n]); while (vocabulary[n]<>'#') do begin inc(n); readln(vocabulary[n]); end; dec(n);l:=0;mistake:=0; while not eof(input) do begin read(bf); case bf of 'a'..'z': begin inc(l); now[l]:=bf; end else begin judge; write(bf); end;{else} end;{case} end;{while} judge; writeln(mistake); end. |
|
|