Advertisement
Ardente

Untitled

Aug 16th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. // Preparing a lovely in string stream
  2. std::istringstream iss(outputString);
  3. // Smash output string into its smaller pieves and shove it into the vector
  4. std::vector<std::string> splitString{ std::istream_iterator<std::string>(iss), {} };
  5. // Reverse it so the parsable string is actually right
  6. std::reverse(splitString.begin(), splitString.end());
  7. // Preparing an output string stream to smoosh things back together
  8. std::ostringstream oss;
  9. // Smash that vector back together againg
  10. std::copy(splitString.begin(), splitString.end(), std::ostream_iterator<std::string>(oss, " "));
  11. // Put it back in the lovely output string
  12. outputString = oss.str();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement