William James wrote:
> William James wrote:
> > 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
>
> seen, s = Hash.new(0)
> print s if ( seen[s] += 1 ) > 1 while s = gets

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