Cod sursa(job #758548)

Utilizator andrei_toaderToader Andrei Sorin andrei_toader Data 15 iunie 2012 22:48:14
Problema Text Scor 60
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.47 kb
program textaha;
var f,g:text;
    c:char;
    i,litere,cuvinte,p:longint;

begin
 assign (f,'text.in'); reset (f);
 assign (g,'text.out'); rewrite (g);
 litere:=0;
 cuvinte:=0;
 while not seekeof (f) do
 begin
  read (f,c);
  if ((c>='a') and (c<='z')) or  ((c>='A') and (c<='z')) then
  begin
   inc(litere);
   if p=0 then
   begin
    p:=1; inc(cuvinte)
   end;
   end
   else
    p:=0;
 end;
 writeln (g,trunc(litere/cuvinte));
 close (F); close (G);
end.