import collections def C(n, r): c = 1 for s in range(n, n - r, -1): c *= s for b in range(r, 0, -1): c //= b return c def solve(): S = input() L = len(S) ans = 1 for n in collections.Counter(S).values(): ans *= C(L, n) L -= n print(ans - 1) def main(): solve() if __name__ == '__main__': main()