Cod sursa(job #900199)

Utilizator gabimoiseMoise Gabriel gabimoise Data 28 februarie 2013 18:12:11
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.95 kb
program text_i;
const m:set of char=['a'..'z','A'..'Z'];
var f,g:text;
    lit,c,ch,sp:real;
    cuv:boolean;
    x,a:char;
    rez:longint;
begin
  assign(f,'text.in');reset(f);
  assign(g,'text.out');rewrite(g);
  cuv:=false; lit:=0; c:=0; ch:=0;
  while not eof(f) do begin
                         read(f,x); ch:=ch+1;
                         if [x]<=m then begin
                                          cuv:=true;
                                          lit:=lit+1;
                                        end
                               else if ([a]<=m) and (ch>1) then
                                       begin
                                         cuv:=false;
                                         c:=c+1;
                                       end;
                     if not([x]<=m) then cuv:=false;
                     a:=x;
                   end;
  rez:=trunc(lit/c);
  writeln(g,rez);
  close(f); close(g);
end.