class Solution { public: string ReverseSentence(string str) { string result = ""; stack<string> strStack; int startPos = 0; for(int i = 0; i < str.length(); i++) { if(str[i] == ' ') { result.insert(0, ' ' + ...