if (found == 0){ // w1 does not match A at position i
return false;
}
}

bool findAndReplace (int * & A , int &n, int * w1 , int n1 , int *w2, int n2){
we write a loop to check whenw1 matches A
//so we search for the position i = 0... n-n1
// since if w1 matches the last part of A[] then the index i would (n-1 - (n1-1))