The original Erdos-Renyi theorem states that $U_n/(\alpha k) \rightarrow 1$ almost surely for a large class of distributions, where $U_n = \sup_{0\leq i \leq n - k} (S_{i+k} - S_i), S_i = X_1 + \cdots + X_i$ is a partial sum of i.i.d. random variables, $k = \kappa(n) = \lbrack c \log n\rbrack, c > 0$, and $\alpha > 0$ is a number depending only upon $c$ and the distribution of $X_1$. We prove that the $\lim \sup$ and the $\lim inf$ of $(U_n - \alpha k)/\log k$ are almost surely equal to $(2t^\ast)^{-1}$ and $-(2t^\ast)^{-1}$, respectively, where $t^\ast$ is another positive number depending only upon $c$ and the distribution of $X_1$. The same limits are obtained for the random variable $T_n = \sup_{1\leq i \leq n}(S_{i+\kappa(i)} - S_i)$ studied by Shepp.