字符移动 题解:(假)冒泡排序法
#include< bits/stdc++.h>
using namespace std;
int main()
{
string s;
getline(cin,s);
int len=s.length();
for(int i=0;i<len-1;i++)
{
for(int j=0;j<len-1;j++)
{
if(!isdigit(s[j+1])&&isdigit(s[j]) )
{
swap(s[j],s[j+1]);
}
}
}
for(char c:s)
cout<<c;
}
登录后发布评论
暂无评论,来抢沙发