#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,k=0,x=0;
    cin>>n;
    int s = n;
    int a[100000];
    while(s>=1){
        a[k] = s%10;
        s = s/10;
        //cout<<a[k]<<" ";
        k++;
    }
    sort(a,a+k);
    for(int i =0;i<k;i++){
        if(a[i]==0){
            x = i;
        }
        if(a[0]==0){
            a[0] = a[x+1];
            a[x+1] = 0;
        }
    }
    //cout<<x;
    for(int i =0;i<k;i++){
      cout<<a[i];  
    }
    return 0;
}

12053 ==> 01235==>10235
20081==>00128==>10028
先读取每一位数字存为数组,再排序,再确定0的位数,然后将0后移,将第一个非0数字向前移动\

c++初学者,代码不规范见谅