{ VERIFICATION PROGRAM for "Bricks" problem for NEERC'2002 }
{ (C) Roman Elizarov, 2002 }
{$APPTYPE CONSOLE}
program BRICKS_CHECK;
uses
  sysutils, testlib in '..\testlib.pas';

const
  YES = 'YES';
  NO = 'NO';

function ReadYesNo(var ins: InStream): boolean;
var
  s: string;
begin
  s := ins.readString;
  if s = YES then
    result := true
  else if s = NO then
    result := false
  else
    ins.quit(_PE, 'Unrecognized responce: ' + s);
end;

function BoolToStr(b: boolean): string;
begin
  if b then
    result := YES
  else
    result := NO;
end;

var
  bouf, bans: boolean;

begin
  try
    bans:= ReadYesNo(ans);
    bouf:= ReadYesNo(ouf);
    if not ouf.seekeof then
      Quit(_PE, 'Extra data in file');
    if bouf <> bans then
      Quit(_WA, 'Wrong answer: ' + BoolToStr(bouf) + ' <> ' + BoolToStr(bans));
    Quit(_OK, 'Ok');
  except on e: Exception do
    Quit(_FAIL, e.Message);
  end;
end.
