Cod sursa(job #71622)

Utilizator M@2Te4iMatei Misarca M@2Te4i Data 11 iulie 2007 00:24:25
Problema Text Scor 90
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.79 kb
program text;

var s:string;
    l,c:int64;
    gasit:boolean;

procedure afisare;
var i:int64;
begin
assign(output,'text.out');
rewrite(output);
if c<>0 then
   i:=trunc(l/c)
   else i:=0;
write(i);
close(output);
end;

procedure procesare;
var i:longint;
begin
for i:=1 to length(s) do
    if (s[i] in ['A'..'Z','a'..'z']) then
       l:=l+1
       else if (s[i-1] in ['A'..'Z','a'..'z']) and
               not (s[i] in ['A'..'Z','a'..'z']) and (l>=1) then
               inc(c);
if s[length(s)]in ['A'..'Z','a'..'z']
   then c:=c+1;
end;

procedure citire;
begin
assign(input,'text.in');
reset(input);
l:=0;
c:=0;
gasit:=false;
while not seekeof do
      begin
      readln(s);
      procesare;
      end;
afisare;
close(input);
end;

begin
citire;
end.