import java.util.*; public class Exercise93{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); String str = sc.next(); int baseR = getRoutes(str.length()); ArrayList s = new ArrayList(); for(int i = 0; i < str.length(); i++){ int count = 1; for (int j = i + 1; j < str.length(); j++){ if(str.charAt(i) == str.charAt(j)){ count++; } } if(count > 0){ s.add(count); } } int sameR = 1; for(int i = 0; i < s.size(); i++){ sameR *= getRoutes(s.get(i)); } System.out.println(baseR / sameR - 1); } private static int getRoutes(int num){ int r = 1; for (int i = 0; i < num; i++){ r *= num - i; } return r; } }