def kaizyo (a) ans = 1 return 1 if(a == 1) (2..a).each do |d| ans *= d end return ans end s = gets.chomp c = Array.new(28) i = 1 (("A")..("Z")).each do |t| c[i] = s.count(t) i += 1 end c.delete(0) c.compact!() ans = kaizyo(s.size) c.each do |d| ans /= kaizyo(d) end p ans -= 1