51Nod 3212 数字变位

水题~。

int main()
{
    string s;
    cin>>s;

    sort(s.begin(),s.end(),greater<int>());

    cout<<s<<' ';

    reverse(s.begin(),s.end());
    int idx=0;
    while(s[0] == '0' && idx<s.size()) swap(s[0],s[idx++]);
    cout<<s<<endl;
    //system("pause");
    return 0;
}
posted @ 2021-04-05 22:46  Dazzling!  阅读(67)  评论(0编辑  收藏  举报