Size of both the strings
int n = S . Length , m = P . Length ; for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { mapS [ i ] = 0 ; mapP [ i ] = 0 ; mapT [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { mapS [ S [ i ] ] ++ ; } for ( int i = 0 ; i < m ; i ++ ) { mapP [ P [ i ] ] ++ ; }