import java.util.*; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws Exception { String s = sc.next(); int l = s.length(); Map map = new HashMap<>(); for (int i = 0;i < l;i++) { String tmp = s.substring(i, i+1); if (map.containsKey(tmp)) { map.put(tmp, map.get(tmp)+1); } else { map.put(tmp, 1); } } int ret = fact(l); for (Map.Entry entry : map.entrySet()) { ret /= fact(entry.getValue()); } System.out.println(ret-1); } private static int fact(int n) { int ret = 1; for (int i = 1;i <= n;i++) { ret *= i; } return ret; } }