Cod sursa(job #1130050)

Utilizator paulabenbendea paula paulaben Data 28 februarie 2014 10:59:52
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.58 kb
program pbtext;
var c:char;nr1,nr2,i:longint;f,g:text;cuv:string;
begin
assign(f,'text.in');reset(f);
assign(g,'text.out');rewrite(g);
nr1:=0;nr2:=0;
while not(eof(f)) do
begin
read(f,c);
cuv:='';
while (((c<'a') or (c>'z')) and ((c<'A') or (c>'Z'))) and (not(eof(f))) do
 read(f,c);
while (((c>='a') and (c<='z')) or ((c>='A') and (c<='Z'))) and (not(eof(f))) do
  begin
   nr1:=nr1+1;
   if length(cuv)<235 then
   cuv:=cuv+c;
   read(f,c)
  end;
if cuv<>''then nr2:=nr2+1;
end;
if nr2=0 then writeln(g,0)
        else
writeln(g,nr1 div nr2);
close(f);
close(g);
end.