Simple Pig Latin Time : Space : 123456789101112131415161718192021using namespace std;std::string pig_it(std::string str) { string now = "", res = ""; auto work = [&]() { if(now.length()) { if(now.length() > 1) res += now.substr(1); res.push_back(now[0]); res += "ay"; now = ""; } }; for(auto& ch : str) { if(isalpha(ch)) now.push_back(ch); else { work(); res.push_back(ch); } } work(); return res;}