Periodic solutions of nonlinear wave equations with nonmonotone forcing terms