1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include <iostream>
using namespace std;
string LOLSpeak(string S, string Abbr, string Replace)
{
int Loc = S.find(" "+Abbr+" ",0);
while (Loc != -1)
{
S.replace(Loc,Abbr.size()+2," "+Replace+" ");
Loc = S.find(" "+Abbr+ " ",0);
}
if (S.substr(0,Abbr.size()+1) == Abbr+" ")
{
S.replace(0,Abbr.size(),Replace);
}
if (S.substr(,Abbr.size()) == " "+Abbr)
{
S.replace(,Abbr.size(),Replace);
}
return S;
}
int main()
{
char Input[80];
cout << "Enter a sentence: ";
cin.getline(Input, 80, '\n');
string Sentence = Input;
Sentence = LOLSpeak(Sentence, "u", "you");
Sentence = LOLSpeak(Sentence, "brb", "be right back");
Sentence = LOLSpeak(Sentence, "lol", "laughing at loud");
Sentence = LOLSpeak(Sentence, "btw", "by the way");
Sentence = LOLSpeak(Sentence, "smh", "shake my head");
Sentence = LOLSpeak(Sentence, "idk", "I don't know");
Sentence = LOLSpeak(Sentence, "imo", "in my opinion");
Sentence = LOLSpeak(Sentence, "fyi", "for your information");
Sentence = LOLSpeak(Sentence, "wwjd", "what would Jesus do");
Sentence = LOLSpeak(Sentence, "ttyl", "talk to you later");
Sentence = LOLSpeak(Sentence, "idc", "I don't care");
Sentence = LOLSpeak(Sentence, "ily", "I love you");
Sentence = LOLSpeak(Sentence, "jk", "just kidding");
cout << Sentence << endl;
}
|