Solve fourth exercise