#include <iostream>
#include <string>
using namespace std;
int main() {
string tweet;
unsigned int pos;
string::npos;
cout << "\nEnter tweet:"; // User enters a complete tweet (160 characters or less)
getline(cin, tweet); // Gets the single line of text
tweet.resize(160); // Resizes to 160 characters
pos = tweet.find("LOL");
if (pos != string::npos) {
tweet.replace(pos, 3, "laughing out loud"); // Note: This expression asks: Does the tweet have "LOL" anywhere?
}
// cout << tweet << endl;
pos = tweet.find("IRL");
if (pos != string::npos) {
tweet.replace(pos, 3, "in real life"); // Note: This expression asks: Does the tweet have "LOL" anywhere?
}
//cout << tweet << endl;
pos = tweet.find("AFK");
if(pos != string::npos) {
tweet.replace(pos, 3, "away from keyboard"); // Note: This expression asks: Does the tweet have "LOL" anywhere?
}
//cout << tweet << endl;
pos = tweet.find("NVM");
if (pos != string::npos) {
tweet.replace(pos, 3, "nevermind"); // Note: This expression asks: Does the tweet have "LOL" anywhere?
}
//cout << tweet << endl;
pos = tweet.find("BFF");
if (pos != string::npos) {
tweet.replace(pos, 3, "best friends forever"); // Note: This expression asks: Does the tweet have "LOL" anywhere?
}
// cout << tweet << endl;
// Note: This expression asks: Does the tweet have "LOL" anywhere?
pos = tweet.find("FTW");
if (pos != string::npos) {
tweet.replace(pos, 3, "for the win");
}
//cout << tweet << endl;
pos = tweet.find("IIRC");
if (pos != string::npos) {
tweet.replace(pos, 3, "if I recall correctly");
}
//cout << tweet << endl;
pos = tweet.find("TTYL");
if (pos != string::npos) {
tweet.replace(pos, 3, "talk to you later");
}
// cout << tweet << endl;
pos = tweet.find("IMHO");
if (pos != string::npos) {
tweet.replace(pos, 3, "in my humble opinion");
}
cout << "Decoded tweet: " << tweet << endl;
return 0;
} |