Cod sursa(job #61331)

Utilizator al3csutzuSirbu Alexandru al3csutzu Data 18 mai 2007 20:55:37
Problema Text Scor 80
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.63 kb
program texte;
var f,g:text;
s,prec,l:string[1];
litere:string;
k,lit,cuv:longint;
begin
  assign(f,'text.in'); assign(g,'text.out');
  reset(f); rewrite(g);
  s[1]:=' '; prec[1]:=' ';
  lit:=0; cuv:=0; k:=0;
  litere:='qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM';
  while not eof(f) do
  begin
    read(f,s[1]);
    if pos(s[1],litere)<>0 then
      begin
        lit:=lit+1;
        if pos(prec[1],litere)=0 then cuv:=cuv+1;
      end;
    if (eoln(f)) and not (eof(F))then l[1]:=s[1];
    prec[1]:=s[1];
  end;
  if pos(l[1],litere)<>0 then cuv:=cuv+1;
  writeln(g,lit/cuv:0:0);
  close(f); close(g);
end.