from math import factorial s = input() x = factorial(len(s)) for c in set(s): x /= factorial(s.count(c)) print(int(x - 1))