problem 51

passed after consulting the solution ;-(