Cod sursa(job #456518)

Utilizator teban.mihaiTeban Mihai Andrei teban.mihai Data 15 mai 2010 20:16:46
Problema Text Scor 30
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.55 kb
var i,n,k:longint;
    s:string;
    incepe:boolean;
    f,g:text;
begin
assign(f,'text.in');
reset(f);
assign(g,'text.out');
rewrite(g);
readln(f,s);
n:=0;
k:=0;
incepe:=false;
for i:=1 to length(s) do
 begin
 if ((s[i]>='a') and (s[i]<='z')) or ((s[i]>='A') and (s[i]<='Z')) then
  incepe:=true;
 if (incepe=true) and ((s[i]=' ') or (s[i]='!') or (s[i]=',') or (s[i]='.') or (s[i]='?')or (s[i]='-')) then
  begin
  inc(k);
  incepe:=false;
  end;
 if (incepe=true) then
  inc(n);
 end;
writeln(g,n div k);
close(f);
close(g);
end.