Consider the differential equation
$$\ddot{x} +n^2 x+h_L (x) =p(t),$$
where $n=1,2,\dots$ is an integer, $p$ is a $2\pi$-periodic function and $h_L$ is the piecewise linear function
$$
h_L (x)=\begin{cases} L & \text{if $x\geq 1$},\\
Lx & \text{if $|x|\leq 1$},\\
-L & \text{if $x\leq -1$}.\end{cases}$$
A classical result of Lazer and Leach implies that this
equation has a $2\pi$-periodic solution if and only if
\begin{equation}\label{ll}
|\hat{p}_n |<{2L\over \pi},
\end{equation}
where
$$\hat{p}_n :={1\over 2\pi}\int_0^{2\pi} p(t)e^{-int}\, dt.$$
In this paper I prove that if $p$ is of class $C^5$ then
the condition (\ref{ll}) is also necessary and sufficient
for the boundedness of all the solutions of the equation.
The proof of this theorem motivates a new variant of
Moser's Small Twist Theorem. This variant guarantees
the existence of invariant curves for certain mappings
of the cylinder which have a twist that may depend on
the angle.
1991 Mathematics Subject Classification: 34C11, 58F35.