Convert the users tweet to a decoded tweet replacing the abb
Convert the user\'s tweet to a decoded tweet, replacing the abbreviations directly within the tweet. You only need to replace the first instance of a particular abbreviation.
Here is an example program execution for step 3 (user input is highlighted here for clarity):
Entertweet:I\'mgoingtohangoutwithmyBFFIRLtomorrow.
Decodedtweet:I\'mgoingtohangoutwithmybestfriendsforeverinreallife tomorrow.
Another example execution for step 3 (user input is highlighted here for clarity):
Entertweet:So,IMHOhewasgoingFTW,butIwassoLOLthatmyBFFthoughtI wasgoingtostartcryingIRL!Anyway,gottago,TTYL...I\'mgoingAFK. Decodedtweet:So,inmyhumbleopinionhewasgoingforthewin,butIwasso laughingoutloudthatmybestfriendsforeverthoughtIwasgoingtostart cryinginreallife!Anyway,gottago,talktoyoulater...I\'mgoingaway fromkeyboard.
it has to be used from this code also.....
#include <iostream>
#include <string>
using namespace std;
int main() {
string tweet;
cout << \"Enter abbreviation from tweet: \";
cin >> tweet;
// Output decoded abbreviation from tweet
if (tweet == \"LOL\") {
cout << \"LOL = laughing out loud\" << endl;
}
else if (tweet == \"IRL\") {
cout << \"IRL = in real life\" << endl;
}
else {
cout << \"Sorry, don\'t know that one.\" << endl;
}
return 0;
}
Solution
#include <iostream>
#include <string>
using namespace std;
int main() {
string tweet;
cout << \"Enter abbreviation from tweet: \";
cin >> tweet;
// Output decoded abbreviation from tweet
if (tweet == \"LOL\") {
cout << \"LOL = laughing out loud\" << endl;
}
else if (tweet == \"IRL\") {
cout << \"IRL = in real life\" << endl;
}
else if (tweet == \"IMHO\") {
cout << \"IMHO = in my humble opinion\" << endl;
}
else if (tweet == \"FTW\") {
cout << \"FTW = for the win\" << endl;
}
else if (tweet == \"TTYL\") {
cout << \"TTYL = talk to you later\" << endl;
}
else if (tweet == \"AFK\") {
cout << \"AFK = away from keyboard\" << endl;
}
else {
cout << \"Sorry, don\'t know that one.\" << endl;
}
return 0;
}
I think you reqiorement is complete now. But if your objective is something else just comment in the comment section below I\'ll help.

