solved in ruby -slow