Cod sursa(job #486562)

Utilizator careizoliZoltan Vicsacsan careizoli Data 21 septembrie 2010 23:16:17
Problema Text Scor 20
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.45 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 in ['a'..'z','A'..'Z'] then begin inc(db); inc(szo) end;

while not eoln(f) do begin
  read(f,c);
  if c in ['a'..'z','A'..'Z'] then inc(db)
   else if x in ['a'..'z','A'..'Z'] then inc(szo);
  x:=c;
end;

close(f);

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

end.