S = input() n = len(S) cnt = {} for s in S: cnt[s] = cnt.get(s, 0) + 1 def comb(n, r): ret = 1 for i in range(n, n - r, -1): ret *= i for i in range(2, r + 1): ret //= i return ret ans = 0 for v in cnt.values(): ans += comb(n, v) n -= v print(ans - 1)