|
|
back to boardWORK !!! This program work! Use: program Vocabulary_1089; const MaxKolvoSlov=100; MaxDlinaSlov=8; StopSimvol='#'; type int_Kolvo=1..MaxKolvoSlov; int_Kolvo_0=0..100; int_Dlina=1..MaxDlinaSlov; Slovo_type=string[MaxDlinaSlov]; Vocabulary=array [int_Kolvo] of Slovo_type; var slovar:Vocabulary; k:int_Kolvo_0; slovo:Slovo_type; stroka:string; Errors:integer; procedure Correct; var i:int_kolvo; j:int_Dlina; b:char; p:byte; WasError:boolean; begin for i:=1 to k do for j:=1 to length(Slovar[i]) do begin slovo:=slovar[i]; for b:='a' to 'z' do begin slovo[j]:=b; repeat WasError:=false; p:=pos(slovo,stroka); if (p>0) and ((not(stroka[p-1] in ['a'..'z'])) or (p=1)) and ((not(stroka[p+length(slovo)] in ['a'..'z']) or (p+length(slovo)=length(stroka)))) and (slovo<>slovar[i]) then begin delete(stroka,p,length(slovo)); insert(slovar[i],stroka,p); inc(errors); WasError:=true; end; until Not WasError; end; end; end; BEGIN k:=0; repeat readln(slovo); if slovo<>StopSimvol then begin inc(k); slovar[k]:=slovo; end; until slovo=StopSimvol; Errors:=0; while not eof do begin readln(stroka); if (stroka='') and (eof) then break; Correct; writeln(stroka); end;
write(Errors); END. Re: WORK !!! faint. This problem is too easy. |
|
|