Add count of subString equal to n - alphaIndex [ i ] [ j ]
rank = rank + ( n - alphaIndex [ i ] . get ( j ) ) ; } } } Vector < String > str = new Vector < String > ( ) ; for ( int i = 0 ; i < alphaIndex [ s [ 0 ] - ' a ' ] . size ( ) ; i ++ ) {