mod=1000000007 gets a=gets.split.group_by{|i|i} p a.keys.combination(3).inject(0){|s,r|s+r.map{|i|a[i].size}.inject(:*)}