A modified Naive Pattern Searching algorithm that is optimized for the cases when all characters of pattern are different
void search ( string pat , string txt ) { int M = pat . size ( ) ; int N = txt . size ( ) ; int i = 0 ; while ( i <= N - M ) { int j ;