Solve odd occurrences problem in linnear time with ruby.