65,206
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string s;
while (getline(cin, s))
{
reverse(s.begin(), s.end());
for (int i = 0; i <= s.size(); ++i)
{
if (s[i] < 0)
{
char temp = s[i];
s[i] = s[i+1];
s[i+1] = temp;
++i;
}
}
cout << s << endl;
}
return 0;
}