We consider one-dimensional second-order partial differential equations describing waves in inhomogeneous and nonlinear media. Contact transformations and Euler differential substitution are used to construct general solutions. General and partial solutions of some nonstationary continuum mechanics models are found.