Let A be an alphabet of cardinality m, k
_n
be a
sequence of positive integers and ω∈ A*
(|ω|=k
_n
). In this paper it is shown that if lim
sup
_{n→∞}
k
_n
/ln n<1/ln m,
then almost all words of length n over A contain the factor ω, but if lim
sup
_{n→∞}
k
_n
/ln n>1/ln m,
then this property is not true. Also, if lim
inf
_{n→∞}
k
_n
/ln n>1/ln m,
then almost all words of length n over A do not contain the factor ω.
Moreover, if lim
_{n→∞}
(ln
n-k
_n
ln m)=α∈ R, then lim
sup
_{n→∞}
|W(n,k
_n
,ω,A)|
/m
^m
≤1−exp (−exp(α)) and lim
inf
_{n→∞}
|W (n,
k
_n
,ω,A)|/m
^n
≥1−exp
(−(1−1/m) exp(α)), where W(n, k
_n
,
ω, A) denotes the set of words of length n over A containing the factor
ω of length k
_n
.