using System; using System.Collections; using System.Collections.Generic; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ var Ca=rs().ToCharArray(); Array.Sort(Ca); int cnt=0; do{ cnt++; }while(NextPermutaion(Ca)); Console.WriteLine(cnt-1); } public Sol(){ } static public bool NextPermutaion(T[] A)where T:IComparable{ for(int i=A.Length-2;i>=0;i--){ if(A[i].CompareTo(A[i+1])<0){ int trgt=Array.FindLastIndex(A,x=>A[i].CompareTo(x)<0); Swap(ref A[i],ref A[trgt]); Array.Reverse(A,i+1,A.Length-(i+1)); return true; } } Array.Reverse(A); return false; } static void Swap(ref T x, ref T y){ T t=x;x=y;y=t; } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(){return Console.ReadLine().Split(' ');} static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} }