#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string s;
getline(cin,s);
char ss[1000];
strcpy(ss, s.c_str());
char*temp=strtok(ss, " ");
int index = 0;
while (temp)
{
index += string(temp).size();
string s0 = temp;
reverse(s0.begin(), s0.end());
temp = strtok(NULL," ");
cout << s0;
for (; index < s.length(); index++) {
if (s[index] != ' ') {
break;
}
else {
cout << s[index];
}
}
}
}
百练OJ-单词翻转
最新推荐文章于 2025-03-08 10:30:23 发布