def main(s) s.chars.permutation(s.size).to_a.uniq.size - 1 end if __FILE__ == $0 p main(gets.chomp) end