solved 37 in ruby