We model the diffusive shock acceleration of particles in a system of two colliding shock waves and present a method to solve the time-dependent problem analytically in the test-particle approximation and high energy limit. In particular, we show that in this limit the problem can be analysed with the help of a self-similar solution. While a number of recent works predict hard (E −1 ) spectra for the accelerated particles in the stationary limit, or the appearance of spectral breaks, we found instead that the spectrum of accelerated particles in a time-dependent collision follows quite closely the canonical E −2 prediction of diffusive shock acceleration at a single shock, except at the highest energy, where a hardening appears, originating a bumpy feature just before the exponential cutoff. We also investigated the effect of the reacceleration of pre-existing cosmic rays by a system of two shocks, and found that under certain conditions spectral features can appear in the cutoff region. Finally, the mathematical methods presented here are very general and could be easily applied to a variety of astrophysical situations, including for instance standing shocks in accretion flows, diverging shocks, backward collisions of a slow shock by a faster shock, and wind-wind or shock-wind collisions.