Exact solution of a reaction-diffusion process with three-site interactions