无脑调用标准库

#include<iostream>
#include<vector>
#include<algorithm>

int main(int argc, char const *argv[])
{
    std::vector<std::string> snum;
    std::string stmp;
    while (std::cin >> stmp)
    {
        snum.push_back(stmp);
    }
    std::reverse(snum.begin(), snum.end());

    for (auto s : snum)
    {
        std::cout << s << " ";
    }
    return 0;
}