import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String S = scanner.nextLine(); System.out.println(new Solver().solve(S)); } } class Solver { public String solve(String S) { int length = S.length(); char[] cc = S.toCharArray(); Map map = new HashMap<>(); for (int i = 0; i < cc.length; i++) { if (map.containsKey(cc[i])) { int r = map.get(cc[i]); map.put(cc[i], r + 1); } else { map.put(cc[i], 1); } } int ans = factrial(length); for (int i : map.values()) { ans /= factrial(i); } return String.valueOf(ans - 1); } private int factrial(int length) { int ans = 1; for (int i = 1; i <= length; i++) { ans *= i; } return ans; } }