Cod sursa(job #71942)

Utilizator M@2Te4iMatei Misarca M@2Te4i Data 12 iulie 2007 11:34:59
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 1.19 kb
program text;

var s:ansistring;
    l,c:int64;

procedure afisare;
var i:longint;
begin
assign(output,'text.out');
rewrite(output);
if c<>0 then
   i:=l div 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
    if ((s[i]>='A') and (s[i]<='Z')) or ((s[i]>='a') and (s[i]<='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
               ((s[i]>='A') and (s[i]<='Z')) or ((s[i]>='a') and (s[i]<='z'))
               and not ((s[i]>='A') and (s[i]<='Z')) or ((s[i]>='a') and (s[i]<='z'))
               then
               inc(c);
if //s[length(s)]in ['A'..'Z','a'..'z']
   ((s[length(s)]>='A') and (s[length(s)]<='Z')) or
   ((s[length(s)]>='a') and (s[length(s)]<='z'))
   then begin c:=c+1;{ gasit:=true} end
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;
//if gasit then dec(c);
afisare;
close(input);
end;

begin
citire;
end.