summaryrefslogtreecommitdiff
path: root/joint-set
blob: b9b9b221e6f690f06e20edb087ccd44582e513e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env ruby

require 'set'
require 'zipf'

n = ARGV.pop.to_i

all = []
all_sets = []
ARGV.each { |file|
  fp = ReadFile.new file
  a = []
  s = Set.new
  while line = fp.gets
    a << line
    s << line
  end
  all << a
  all_sets << s
}

joint_set = all_sets.pop
all_sets.each { |set|
  joint_set &= set
}

joint_set.each { |i|
  puts i
}