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