import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import java.io.BufferedInputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentSkipListSet; public class Main { public static final int C = 1000000007; static final int CY = 1000000000; //static boolean MAP[][]; static int K; static int B; static int[][] POS; static String S; static int X[][]; static int HA[]; static long DP[]; static int ST[][]; static ConcurrentSkipListSet TS; static ArrayList AL; public static void main(String[] args) { StringBuilder sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); S = sc.next(); long ans = 1; int[] a = new int[26]; for (int i=0; i < S.length(); i++) { char c = S.charAt(i); a[c - 'A']++; } ans = msd(S.length()); for (int i=0; i< 26; i++) { ans /= msd(a[i]); } System.out.println(ans-1); } static long msd(int num) { long ret = 1; for (int i=1; i <= num; i++) { ret *= i; } return ret; } }