solution for problem21