Cod sursa(job #1615783)

Utilizator DoubleNyNinicu Cristian DoubleNy Data 26 februarie 2016 21:07:57
Problema Text Scor 80
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.93 kb

var
  ch,predch:char;
  i,j,words,letters,chars:integer;
Begin
    assign(input,'text.in');  reset(input);
    assign(output,'text.out'); rewrite(output);
    read(input,ch);
    // letters:=0;
    // words:=0;
    read(input,ch);
    if ch in ['a'..'z','A'..'Z'] then begin inc(letters); inc(words); end;
    predch:=ch;
   while not(eof(input)) do
    begin
         predch:=ch;
         read(ch);
         if ch in ['a'..'z','A'..'Z'] then inc(letters);
         if (ch in ['a'..'z','A'..'Z']) and ((ord(predch)<65) or (ord(predch)>122) or ( (ord(predch)<97) and (ord(predch)>90) ) )  then inc(words);
    end;
   // if eoln(input) then readln(input);
  //  until eof(input);
   // if ch in ['a'..'z','A'..'Z'] then inc(letters); if not( ch in ['a'..'z','A'..'Z']) then dec(words);
    // writeln(predch,' ',ch);
   // writeln(letters,' ',words);
    write(output,letters div words);
    close(input);
    close(output);
end.