from collections import Counter from math import factorial def calc_combination(all_: int, partial_: int) -> int: return factorial(all_) // (factorial(partial_) * factorial(all_ - partial_)) def main(): S = input() s_counter = Counter(S) rest = s_counter.total() patterns = 1 for _, count_ in s_counter.most_common(): patterns *= calc_combination(rest, count_) rest -= count_ print(patterns - 1) if __name__ == "__main__": main()