Cod sursa(job #791709)

Utilizator alextudose95Tudose Stefan Alexandru alextudose95 Data 24 septembrie 2012 21:36:35
Problema Text Scor 90
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.63 kb
program textora12noaptea;
type sir=array[1..1048576] of char;
var a:sir;
    i,n:longint;
    nrc,lcuv:integer;
    f,g:text;
begin
assign(f,'text.in');reset(f);
assign(g,'text.out');rewrite(g);
i:=1;
while not eof(f) do begin
   read(f,a[i]);
   inc(i);
   end;

n:=i-1;
a[n+1]:=' ';
 for i:=1 to n do begin
   a[i]:=upcase(a[i]);
   if not (a[i] in ['A'..'Z','0'..'9']) then a[i]:=' ';
   end;

nrc:=0;
lcuv:=0;
for i:=1 to n do begin
        if a[i] in ['A'..'Z'] then inc(lcuv);
        if (a[i] in ['A'..'Z']) and (a[i+1]=' ') then inc(nrc);
                      end;
write(g,lcuv div nrc);
close(g);
end.