Advertisement
agul

Golden Middle 2012 :: Problem B :: check.dpr

Mar 30th, 2012
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.71 KB | None | 0 0
  1. uses
  2.   SysUtils, unJudge17;
  3.  
  4. var
  5.   i : longint;
  6.   ja, pa : string;
  7.  
  8. function compress(s : string) : string;
  9. begin
  10.   if length(s) < 100 then compress := s else compress := copy(s, 1, 50) + '..' + copy(s, length(s) - 24, 50);
  11. end;
  12.  
  13. begin
  14.     pa := ouf.readString();
  15.     ja := ans.readString();  
  16.     i := length(pa);
  17.     while (i > 0) and (pa[i] = ' ') do dec(i);
  18.     delete(pa, i + 1, length(pa) - i);
  19.     i := length(ja);
  20.     while (i > 0) and (ja[i] = ' ') do dec(i);
  21.     delete(ja, i + 1, length(ja) - i);  
  22.     if pa <> ja then quit(_wa, 'Expected: "' + compress(ja) + '", found: "' + compress(pa) + '"');
  23.     if not ouf.seekEOF() then quit(_wa, 'Extra lines! "' + ouf.readString() + '" encountered');
  24.     quit(_ok, '1 line');
  25. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement