Add solution to 8th problem