from math import factorial as f from collections import Counter as c s = c(raw_input()).values() print f(sum(s)) / reduce(lambda x,y:f(x)*f(y), s, 1) - 1