import math from collections import Counter S = input() def nCr(n, r): f = math.factorial return f(n) // f(r) // f(n-r) cnt = sorted(list(Counter(S).values()), reverse=True) ans = 1 s = len(S) for c in cnt: ans *= nCr(s, c) s -= c print(ans-1)