Cod sursa(job #71244)

Utilizator M@2Te4iMatei Misarca M@2Te4i Data 9 iulie 2007 20:35:19
Problema Text Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 1.03 kb
program text;

var s,d:char;
    l,c:integer;
    gasit,f:boolean;

procedure afisare;
var i:integer;
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:integer;
begin
//for i:=1 to length(s) do
f:=false;
while not seekeoln do begin
    if f then
       d:=s;
    readln(s);
    f:=true;
    if (s in ['A'..'Z','a'..'z']) then
       begin
       l:=l+1;
       gasit:=true;
       end
       else if (d in ['A'..'Z','a'..'z']) and
               not (s in ['A'..'Z','a'..'z']) and (l>=1) and f then
               begin
               inc(c);
               gasit:=false;
               end;
end;
if s in ['A'..'Z','a'..'z']
   then c:=c+1;
end;

procedure citire;
begin
assign(input,'text.in');
reset(input);
gasit:=false;
while not seekeof do
      begin
//      if gasit then
//         c:=c-1;

      procesare;
      readln;
      end;
afisare;
close(input);
end;

begin
citire;
end.