import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); char[] input = scanner.next().toCharArray(); scanner.close(); int[] alphabets = new int[26]; for (int i = 0; i < input.length; i++) { alphabets[(int) input[i] - 'A']++; } long ans = 1; for (int i = 1; i <= input.length; i++) { ans *= i; } for (int i = 0; i < alphabets.length; i++) { for (int j = 1; j <= alphabets[i]; j++) { ans /= j; } } System.out.println(ans - 1); } }