Brute force problem 3 ruby