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