Cod sursa(job #284621)

Utilizator frozen62iceBLue FirE frozen62ice Data 21 martie 2009 20:40:09
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.54 kb
var f,g:text;
    ok1,ok2:boolean;
    x:char;
    numar_litere,numar_cuvinte:longint;
begin
assign(f,'text.in');reset(f);
assign(g,'text.out');rewrite(g);
numar_cuvinte:=0;
numar_litere:=0;
while not eof(f) do begin
 ok1:=false;
 ok2:=false;
 while not eoln(f) do begin
  read(f,x);
  if x in ['a'..'z','A'..'Z'] then ok2:=true
   else ok2:=false;
  if not ok1 and ok2 then inc(numar_cuvinte);
  if ok2 then inc(numar_litere);
  ok1:=ok2;
 end;
 readln(f);
end;
writeln(g,numar_litere div numar_cuvinte);
close(f);
close(g);
end.