Added solution for #115. (In p114.hs; it generalizes #114.)