#include #include using namespace std; int main() { string oldSentence; oldSentence = "The quick brown dog jumped WAY over the lazy cat."; // ADD CODE HERE: display oldSentence // ADD CODE HERE: display the length of oldSentence // Do not make any change to the following code. // Just read and understand this program. // To create a new sentence without "WAY ": // First, find the positition where WAY appears int i = oldSentence.find("WAY "); cout << "i is " << i << endl; // Second, get the characters up to "WAY " string newSentence = oldSentence.substr(0, i); cout << "Modified sentence: " << newSentence << endl; // Finally, append the characters after "WAY " // "WAY " is 4 characters long, so start 4 characters after i. // Leave out the second argument to get the rest of the line. newSentence = oldSentence.substr(0, i) + oldSentence.substr(i + 4); //OR: newSentence += oldSentence.substr(i + 4); cout << "Completed sentence: " << newSentence << endl; return 0; }