Add solution for problem #29