solution for the fourth test