#include using namespace std; #include int main() { string sentence="I am a elephant"; int pos; string animal_1="elephant"; string animal_2="cat"; int last_char; cout << sentence << endl; cout << "The sentence is " << sentence.length() << " characters long." << endl; pos=sentence.find(animal_1); cout << pos << endl; sentence.replace(pos,animal_2.length(),animal_2); last_char=sentence.length()-1; //sentence.erase(10,5); int chop_mark=pos+animal_2.length(); int end_of_sentence=sentence.length()-1; sentence.erase(chop_mark,end_of_sentence-chop_mark+1); cout << sentence << endl; cout << "The sentence is " << sentence.length() << " characters long." << endl; cout << sentence << endl; }