From: S2 Date: 2008-04-26T23:00:04+09:00 Subject: Re: All occurances of a character in a string S2 wrote: > irb(main):006:1>   ret[c] = ret[c].nil? ? d : d << ret[c] > irb(main):007:1>   ret[c].flatten! oh sorry, here are a few things that are not needed: a = "abbccdaab" i = 0 ret = Hash.new a.scan(/./) {|c| ret[c] = ret[c].nil? ? [i] : ret[c] << i i = i + 1 } p a p ret