solved 38 in ruby