字符移动(c++)
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s, s1 = "", s2 = "";//保存完整字符串、字符、数字
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] >= '0' && s[i] <= '9')
s2 += s[i];
else
s1 += s[i];
}
cout << s1 << s2 << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发