Cod sursa(job #823735)

Utilizator atatomirTatomir Alex atatomir Data 25 noiembrie 2012 16:34:31
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.7 kb
var fin,fout:text;
    s:string;
    cuv:longword;
    lit,l,i:longword;
    sant:boolean;

begin
  assign(fin,'text.in'); reset(fin);
  cuv:=0;
  lit:=0;
  sant:=true;

  read(fin,s);
  while  s <> '' do
  begin
    l:= length(s);
    for i := 1 to l do
    begin
      if ((ord(s[i])>$40) and (ord(s[i])<=$5A)) or ((ord(s[i])>$60) and (ord(s[i])<=$7A)) then
      begin
        inc(lit);
        if sant = true then
        begin
          inc(cuv);
          sant:=false;
        end;
      end
      else
        sant:=true;
    end;
    read(fin,s);
  end;

  lit:= lit div cuv;
  close(fin);
  assign(fout,'text.out'); rewrite(fout);
  write(fout,lit);
  close(fout);
end.