from collections import Counter import math S = input() c = Counter(S) ans = math.factorial(len(S)) - 1 for v in c.values(): ans //= math.factorial(v) print(ans)