import math S = [x for x in input()] N = len(S) l = [] while len(S) > 0: c = S[0] l.append(S.count(c)) while c in S: S.remove(c) ans = math.factorial(N) for x in l: ans = ans / math.factorial(x) print(str(int(ans-1)))