Eric Hodel wrote:

> seen = {}
>
> ARGF.each do |elem|
>    print elem if seen.include? elem
>    seen[elem] = true
> end

seen = {}
while s = gets
  print s if seen.key? s
  seen[ s ] = nil
end

Or:

seen = Hash.new(0)
while s = gets
  print s if ( seen[s] += 1 ) > 1
end