Solution for Problem #52