import collections import math def solve(): S = input() L = len(S) ans = math.factorial(L) for n in collections.Counter(S).values(): ans //= math.factorial(n) print(ans - 1) def main(): solve() if __name__ == '__main__': main()