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

Any ideas about my non-working solution?
Posted by MadMag 28 Mar 2010 00:55
I've got WA on test 1. =(

var
 flag, i, ans:integer;
 s:string;

begin
  assign(input, 'C:\a.txt');reset(input);
  ans := 0;
  flag := 0;
  while not eof(input) do begin
    readln(s);
    i:=1;
    while i<=length(s) do begin
      while s[i] in [' ', ',', ';', ':', '-'] do
        i:=i+1;
      if (flag = 0)and((ord(s[i])<ord('A')) or (ord(s[i])>ord('Z'))) then
        ans:= ans + 1;
      flag:=1;
      if ((ord(s[i-1])>=ord('A')) and (ord(s[i-1])<=ord('Z')))
         and ((ord(s[i])>=ord('A')) and (ord(s[i])<=ord('Z'))) then
           ans:= ans+1;
      if s[i] in ['.', '?', '!'] then
        flag := 0;
      i:=i + 1;
    end;
  end;
  writeln(ans);
end.

Edited by author 28.03.2010 00:56
Re: Any ideas about my non-working solution?
Posted by ile 28 Mar 2010 04:31
do not read from "C:/a.txt"!?