ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1038. Spell Checker

Look at my prog, why WA? Some tests plzz.
Posted by Akshin 31 Mar 2005 20:59
Plz give me some tests.
And it will be great if you can find mistake in my prog :

var
  s:array[1..40] of string;
  n,i,j,k:integer;
  b:boolean;

procedure readdata;
begin
{  assign(input,'in.in');
  reset(input);}
  n:=0;
  while not eoln do
  begin
    inc(n);
    readln(s[n]);
  end;
{  close(input);}
end;


begin
  readdata;
  b:=true;

  for i:=1 to n do
  for j:=1 to length(s[i]) do
  if (b) and ((s[i][j] in ['A'..'Z']) or (s[i][j] in ['a'..'z'])) then
  begin
    b:=false;
    if s[i][j] in ['a'..'z'] then inc(k);
  end else
  if (s[i][j]='.') or (s[i][j]='!') or (s[i][j]='?') then
  begin
    b:=true;
  end else
  if (s[i][j] in ['A'..'Z']) then
  begin
    if (j>1) and ((s[i][j-1] in ['A'..'Z']) or (s[i][j-1] in ['a'..'z'])) then
    inc(k);
  end;
  writeln(k);
end.
Re: Look at my prog, why WA? Some tests plzz.
Posted by Cybernetics Team 1 Apr 2005 14:24
Here is Test #4:
   Sgfghfgh......
   jknkj
   klnmkln
   klnkl

   klnklnklnlk

   ..A.S.S.SD.D.D.F.F.FF.FF.F.F


the answer is 4