Cod sursa(job #488217)

Utilizator careizoliZoltan Vicsacsan careizoli Data 27 septembrie 2010 22:27:27
Problema Text Scor 60
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.57 kb
var f:text;
    c,x:char;
    db,szo:longint;

begin
assign(f,'text.in');
reset(f);

db:=0; szo:=0;
read(f,x);
if ((x>='a')and(x<='z'))or((x>='A')and(x<='Z')) then begin inc(db); inc(szo) end;

while not eof(f) do begin
  read(f,c);
  if ((c>='a')and(c<='z'))or((c>='A')and(c<='Z')) then inc(db)
   else if (((x>='a')and(x<='z'))or((x>='A')and(x<='Z'))) then inc(szo);
  x:=c;
end;
if (((x>='a')and(x<='z'))or((x>='A')and(x<='Z'))) then inc(szo);
close(f);

assign(f,'text.out');
rewrite(f);
if szo=0 then write(f,0)
else write(f,db div szo);
close(f);

end.