Solvable model of strings in a time-dependent plane-wave background