A function to find rank of a string in all permutations of characters
static int findRank ( string str ) { int len = str . Length ; int mul = fact ( len ) ; int rank = 1 ; int countRight ; for ( int i = 0 ; i < len ; ++ i ) { mul /= len - i ;