Hey I know this is a stupid question but I really need to complete an exercise in my programming class, and I can't find the solution anywhere.
Essentially I need to search a 'tweet' for abbreviations like lol and replace them with actual words.
I've tried this code but it deletes the beginning of the string sometimes.
string usertweet;
cout << "Please enter a tweet. " << endl;
cin >> usertweet;
getline(cin, usertweet);
usertweet.resize(160); // Cut down the tweet to 160 chars.
int position; //Used for searching for abrvs.
position = usertweet.find("AFK");
if (position >= 0) {
usertweet.replace(position,3,"Away from Keyboard");
}
position = usertweet.find("BRB");
if (position >= 0) {
usertweet.replace(position,3,"Be Right Back");
}
cout << usertweet;
Sorry for the dumb question and thank you so much in advance!