Cod sursa(job #21124)

Utilizator asu_the_bestRusu Robert asu_the_best Data 22 februarie 2007 22:01:36
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.65 kb
const litere=['A'..'Z','a'..'z','0'..'9'];
var prop:string;
    i,t,c,l,t2:longint;
begin
assign(input,'text.in');reset(input);
assign(output,'text.out');rewrite(output);
 readln(prop);prop:=prop+' ';t2:=length(prop);
 while i<t2  do begin
  inc(i);
  if ((prop[i]) in litere) then inc(l)
                                 else begin if (prop[i-1]<>' ') then inc(c);
                                       while not(prop[i+1] in litere)do
                                        inc(i);
                                       end;

 end;
 if l div c=0 then write(l)
              else writeln(l div c);
close(input);close(output);
end.