Cod sursa(job #1631463)

Utilizator medicinedoctoralexandru medicinedoctor Data 5 martie 2016 16:19:36
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.56 kb
var q,x,y:int64;
c:char;

function ch(x:char):boolean;
begin
   if ((ord(x)>64) and (ord(x)<91)) or ((ord(x)>96) and (ord(x)<123)) then ch:=true else ch:=false;
end;

procedure lire;
begin
  assign(input,'text.in');
  reset(input);
  q:=0;
  x:=0;
  y:=0;
  while not(eof) do
  begin
    read(c);
    if ch(c) then x:=x+1 else begin q:=q+x; if x<>0 then y:=y+1; x:=0; end;
  end;
  close(input);
end;

procedure ecrire;
begin
  assign(output,'text.out');
  rewrite(output);
  write(q div y);
  close(output);
end;

begin
  lire;
  ecrire;
end.