```On 12.10.2006 17:24, Jason Burgett wrote:
> I'm basically trying to the opposite of .uniq Let's say I have an array:
>
> ["a", "a", "a", "b", "c", "d", "d"]
>
> I would like to boil this down by first tossing the values that only
> appear once. Which leaves me with:
>
> ["a", "a", "a", "d", "d"]
>
> Then I need to somehow determine that "a" appears 3 times and "d"
> appears 2 times. Any help would be great. Thanks.

Did anyone suggest inject + partition yet?  If not:

irb(main):001:0> a = ["a", "a", "a", "b", "c", "d", "d"]
=> ["a", "a", "a", "b", "c", "d", "d"]
irb(main):002:0> stat = a.inject(Hash.new(0)) do |h, e|
irb(main):003:1*   h[e] += 1
irb(main):004:1>   h
irb(main):005:1> end
=> {"a"=>3, "b"=>1, "c"=>1, "d"=>2}
irb(main):006:0> one, multi = stat.partition {|e,c| c == 1}
=> [[["b", 1], ["c", 1]], [["a", 3], ["d", 2]]]
irb(main):007:0> one
=> [["b", 1], ["c", 1]]
irb(main):008:0> multi
=> [["a", 3], ["d", 2]]
irb(main):009:0> one.map! {|e,c| e}
=> ["b", "c"]

Kind regards

robert

```