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 1089. Verification with the Dictionary

Filippov Nickolas SSAU#2's AC program is HERE!
Posted by Nickolas 20 Feb 2003 10:29
program test;
 var a:array[1..100] of string[10];
     str:string;
     count:longint;
     ch:char;
     errors:longint;
     wordstr:string;
 function like(stra,strb:string):boolean;
  var i:integer;
      h:integer;
   begin
     like:=false;
     if length(stra)=length(strb) then begin
       i:=1; h:=0;
       while (i<=length(stra))and(h<=1) do begin
         if stra[i]<>strb[i] then inc(h);
         inc(i);
       end;
       if h=1 then like:=true;
     end;
   end;

 function check(var str:string):boolean;
  var i:integer;
   begin
    check:=false;
    for i:=1 to count do
      if like(str,a[i]) then begin str:=a[i]; check:=true; break;
end;
     end;


    begin
   count:=0;
   readln(str);
   while str<>'#' do begin
     inc(count);
     a[count]:=str;
     readln(str);
   end;
   wordstr:='';
   errors:=0;
   while not eof do begin
     read(ch);
     if ch in ['a'..'z'] then wordstr:=wordstr+ch
     else begin
              if check(wordstr) then inc(errors);
             write(wordstr);
             wordstr:='';
             write(ch);
         end;
   end;
   writeln(errors);
    end.
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by Fast Coder 14 Apr 2005 15:00
Please don't post your solution here.
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by jedimastex 17 Jan 2006 20:54
This code is NOT AC anyway;)
It requires two lines to get it.