using System; using System.Collections.Generic; using System.Linq; namespace yukicoder { public class Program { public static void Main() { var s = Console.ReadLine(); var d = new Dictionary(); var l = new List(); foreach(var c in s) { if (d.ContainsKey(c)) { d[c]++; } else { d.Add(c, 1); l.Add(c); } } var k = 1; foreach(var c in l) { k *= Factorial(d[c]); } Console.WriteLine(Factorial(s.Length) / k - 1); } static int Factorial(int n) => n == 0 ? 1 : n * Factorial(n - 1); } }