Cod sursa(job #604948)

Utilizator Andru_Andru Felipe Zuniga Andru_ Data 26 iulie 2011 11:13:32
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.45 kb
program cuvinte;
var
 ch:set of char;
 s:string;
 i,l,c:integer;
 f,g:text;
begin
 assign(f,'text.in');
 assign(g,'text.out');
 reset(f);
 read(f,s);
 close(f);
 ch:=['a'..'z','A'..'Z'];
 for i:=1 to length(s) do
  begin
   if s[i] in ch then
    inc(l);
   if (s[i]=' ') or (s[i]='-') and (i<>1) then
    inc(c);
   if (i=1) and (s[i]<>' ') and (s[i]<>'-') then
    inc(c);
  end;
 rewrite(g);
 writeln(g,l div c);
 close(g);
end.