import collections import math s = input() counter = collections.Counter(s) answer = math.factorial(len(s)) for i in counter.values(): answer //= math.factorial(i) print(answer - 1)