Cod sursa(job #38458)

Utilizator taloibogdanTaloi Bogdan Cristian taloibogdan Data 25 martie 2007 20:07:00
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.54 kb
Program textul;
Var alfabet:set of char;
    f:text;
    c,nc:longint;
    s,ss:char;
Begin
  alfabet:=['a'..'z','A'..'Z'];
  assign(f,'text.in');
  reset(f);
  c:=0;
  nc:=0;
  s:='=';
  repeat
   ss:=s;
   read(f,s);
   if s in alfabet then c:=c+1;
   if ss<>'=' then if (not(s in alfabet)) and (ss in alfabet) then nc:=nc+1;
  until(eoln(f));
  close(f);
  if s in alfabet then nc:=nc+1;
  assign(f,'text.out');
  rewrite(f);
  if nc=0 then Writeln(f,'0')
          else Writeln(f,c div nc);
  close(f);
  Writeln;
End.