Cod sursa(job #22769)

Utilizator adi_nmAdrian Negreanu adi_nm Data 27 februarie 2007 13:56:26
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.57 kb
const litere=['a'..'z','A'..'Z'];
var s,c:ansistring;
    i,j,n:longint;
    nrl,nrc:longint;
begin
  assign(input,'text.in'); reset(input);
  assign(output,'text.out'); rewrite(output);
  while not eof do begin
    readln(c); s:=s+' '+c;
  end;
  n:=length(s);
  s:=s+' '; i:=1;
  repeat
    while (not (s[i] in litere))and(i<=n) do inc(i);
    if i>n then break;
    j:=i+1;
    while s[j] in litere do (inc(j));
    inc(nrl,j-i); inc(nrc);
    i:=j;
  until false;
  if nrc=0 then write(0)
  else write(nrl div nrc);
  close(input); close(output);
end.