using System; using System.Collections.Generic; namespace _170 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); Dictionary dic = new Dictionary(); for (int i = 0; i < s.Length; i++) { if (!dic.ContainsKey(s[i])) dic[s[i]] = 0; dic[s[i]]++; } long ret = 1; for (int i = 1; i <= s.Length; i++) ret *= i; foreach (var item in dic) { int a = 1; for (int i = 1; i <= item.Value; i++) a *= i; ret /= a; } Console.WriteLine(ret - 1); } } }