Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DuckSoft/9f20717b247029b80c775e3638fbb49e to your computer and use it in GitHub Desktop.
Save DuckSoft/9f20717b247029b80c775e3638fbb49e to your computer and use it in GitHub Desktop.
Nowcoder 句子反转
// 垃圾思路
#include <vector>
#include <iostream>
#include <sstream>
using namespace std;
int main() {
stringstream ss;
vector<string> fucker;
string str; while (getline(cin, str)) {
ss << str; fucker.clear();
while (ss >> str) {
fucker.push_back(str);
}
bool first; first = true;
for (auto i = fucker.rbegin(); i != fucker.rend(); ++i) {
first = (first ? false : (cout << ' ', false));
cout << *i;
}
cout << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment