
#include <string> // for storing strings in a C++ way
#include <sstream> // to easily separate sentences into words
#include <vector> // to dynamically store arbitrary amounts of words
#include <algorithm> // for std::reverse
#include <iostream> // for printing the result

int main()
{
    std::string sentence = "Your sentence which contains ten words, two of them numbers";
    std::stringstream stream(sentence);
    std::string word;
    std::vector<std::string> words;
    while ( stream >> word )
    {
        words.push_back(word);
    }
    std::reverse(words.begin(), words.end());
    for ( size_t i(0); i < words.size(); ++i )
    {
        std::cout << words[i] << " ";
    }
    std::cout << "\n";
}
