program DICT_CHECK;
uses
  testlib;

var
  wa: boolean;
  wm: string;
  sinf, souf, sans: string;

procedure FastCompress (var s: string);
var i, j: integer;
begin
   i := 1; while (i<=length(s)) and (s [i] = ' ') do inc (i);
   if i > length (s) then s := ''
   else begin
     j := length (s); while s [j] = ' ' do dec (j);
     s := copy (s, i, j-i+1);
  end;
end;

function Compress (s: string): string;
begin
   FastCompress (s);
   Compress := s;
end;



begin
  wa:= false;

  while not inf.seekeof do begin
    sinf:= inf.readString;
    souf:= ouf.readString;
    sans:= ans.readString;

    if compress(souf) <> compress(sinf) then
      Quit(_PE, 'Wrong/missing word in output: ' + souf + ' <> ' + sinf );

    if not wa and (souf <> sans) then begin
      wa:= true;
      wm:= 'Wrong answer: ' + souf + ' <> ' + sans;
    end;
  end;

  if not ouf.seekeof then Quit(_PE, 'Extra data in file');
  if wa then Quit(_WA, wm);

  Quit(_OK, 'Ok');
end.
