C solution for problem 53