Cod sursa(job #1615809)

Utilizator DoubleNyNinicu Cristian DoubleNy Data 26 februarie 2016 21:25:38
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.87 kb
var  ch,predch:char;
     letters,words,ordinech,ordinepred:longint;
begin
     assign(input,'text.in');
     reset(input);
     assign(output,'text.out');
     rewrite(output);
     read(input,ch);
     predch:=ch;
     ordinech:=ord(ch);
     if ((ordinech>64)and(ordinech<91))or((ordinech>96)and(ordinech<123)) then
     begin
       inc(letters);
       inc(words);
     end;

   while not(eof(input)) do
   begin
     predch:=ch;
     read(input,ch);
     ordinepred:=ord(predch);
     ordinech:=ord(ch);
      if (((ordinech<123)and(ordinech>96))or((ordinech<91)and(ordinech>64)))and((ordinepred<65)or(ordinepred>122)or((ordinepred>90)and(ordinepred<97))) then inc(words);
      if ((ordinech>64)and(ordinech<91))or((ordinech>96)and(ordinech<123)) then inc(letters);
   end;

   write(output,letters div words);
   close(input);
   close(output);
end.