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