Cod sursa(job #1051197)

Utilizator vyrtusRadu Criuleni vyrtus Data 9 decembrie 2013 20:08:14
Problema Text Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.73 kb
Program text_infoarena;
  const lmic=['a'..'z']; lmare=['A'..'Z'];
var  f,g:text;
  l,k:longint;
   c:char;
    ok:boolean;

BEGIN
   assign(f,'text.in'); reset(f);
   assign(g,'text.out'); rewrite(g);

      l:=0; k:=1; ok:=false;
     while (not(eof(f))) do
      begin
        read(f,c);
         if (not(ok)) then
          begin
            if ((c in lmic) or (c in lmare)) then
             begin
               k:=k+1;
               ok:=true;
             end;
          end;

          If ((c in lmic) or (c in lmare)) then
           inc(l)
            else
             ok:=false;

      end;


       if k>0 then
      writeln(g,trunc(l/k))
       else writeln(g,'0') ;
   close(f); close(g);
END.