This is the solution to the program.