Cod sursa(job #1089495)

Utilizator DjokValeriu Motroi Djok Data 21 ianuarie 2014 18:51:19
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.52 kb
program textul;
 var f :text;
     s :string;
     lc,i,nc :byte;
begin
 assign(f,'textul.in');
 reset(f);
 read(f,s);
 lc:=0;nc:=0;
 for i:=1 to length(s) do begin
                           if s[i] in ['A'..'Z','a'..'z'] then inc(lc);
                           if (not(s[i] in ['A'..'Z','a'..'z']))and(s[i-1] in ['A'..'Z','a'..'z']) then inc(nc);
                          end;
 close(f);
 assign(f,'textul.out');
 rewrite(f);
 writeln(f,'Lungimea medie a cuvintelor este ',trunc(lc/nc));
 close(f);
end.