Solution for problem 26