Cod sursa(job #574587)

Utilizator andreifirstCioara Andrei Ioan andreifirst Data 7 aprilie 2011 12:17:36
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.64 kb
var f, g:text;
    cuv, lit:longint;
    ok:boolean;
    c:char;
    buf:array[1.. 1 shl 17] of char;

begin
assign (f, 'text.in'); settextbuf (f, buf); reset (f);
assign (g, 'text.out'); rewrite (g);
ok:= true;
while not eof (f) do
  begin
  read (f, c);
  case c of
    'a'..'z':begin
             if ok then begin inc (cuv); ok:= false; end;
             inc (lit);
             end;
    'A'..'Z':begin
             if ok then begin inc (cuv); ok:= false; end;
             inc (lit);
             end;
    else begin
         ok:= true;
         end;
    end;
  end;

writeln (g, lit div cuv);

close (f); close (g);
end.