A solution to challenge 146