1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/env ruby uniq = false uniq = true if ARGV.include? "uniq" count = true if ARGV.include? "count" while line = STDIN.gets a = line.strip.split a.uniq! if uniq a.sort! if not count puts a.join " " else puts a.size end end