i:=1;
while i<=Length(s) do begin
m:=i;
n:=0;
repeat
while (i<=Length(s)) and not (s[i] in Letters) do Inc(i);
while (i<=Length(s)) and (s[i] in Letters) do Inc(i);
Inc(n)
until s[i]='.';
if n=k then r:=r+Copy(s,m,i-m+1);
Inc(i)
end;