import math f = math.factorial w = list(input()) n = len(w) dct = {} for i in w: dct.setdefault(i,0) dct[i] += 1 r = 1 for i,j in dct.items(): r *= comb(n,j) n -= j print(r-1)