7 条题解
-
0
#include #include #include using namespace std;
int main() { string input; getline(cin, input);
stack<string> wordStack; stringstream ss(input); string word; while (ss >> word) { wordStack.push(word); } bool first = true; while (!wordStack.empty()) { if (!first) cout << " "; first = false; cout << wordStack.top(); wordStack.pop(); } return 0;
}
-
0
#include #include #include using namespace std;
int main() { string input; getline(cin, input);
stack<string> wordStack; stringstream ss(input); string word; while (ss >> word) { wordStack.push(word); } bool first = true; while (!wordStack.empty()) { if (!first) cout << " "; first = false; cout << wordStack.top(); wordStack.pop(); } return 0;
}
language
`
-
0
#include <stdio.h> #include <iostream> #include <string.h> const int N = 2e5 + 10; using namespace std; int main() { char a[1000]; cin.getline(a,1000); int len = strlen(a); for(int i = len - 1;i >= 0;i--) { if(a[i] == ' ' || i == 0) { int j = i + 1; if(i == 0) j = 0; while(a[j] !=' ' && a[j] != '\0') { cout << a[j]; j++; } cout << " "; } } return 0; }
- 1
信息
- ID
- 1093
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 537
- 已通过
- 216
- 上传者