import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); int[] counts = new int[26]; for (char c : arr) { counts[c - 'A']++; } long ans = kaijo(arr.length); for (int x : counts) { ans /= kaijo(x); } System.out.println(ans - 1); } static long kaijo(int x) { if (x == 0) { return 1; } else { return x * kaijo(x - 1); } } }