Store all characters of anotherStr in a direct index table for quick lookup .
bool illegal [ MAX_CHAR ] = { false } ; for ( int i = 0 ; i < anotherStr . size ( ) ; i ++ ) illegal [ anotherStr [ i ] ] = true ;