import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static final int SIZE = 26; public static long fact(long n){ long ret = 1; for(long i = 1; i <= n; i++){ ret *= i; } return ret; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); final char[] inputs = sc.next().toCharArray(); char[] counter = new char[SIZE]; for(final char c : inputs){ counter[c - 'A']++; } long answer = fact(inputs.length); for(int i = 0; i < SIZE; i++){ answer /= fact(counter[i]); } System.out.println(answer - 1); } }