Problem: Contest Page | CodeChef
DIFFICULTY:
EASY.
PROBLEM:
The chef has a number N, Cheffina challenges chef to form the largest number X from the digits of N.
Program:
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
for(int i=1;i<=t;i++)
{
string s;
cin>>s;
sort(s.begin(),s.end());
for(int i=s.length()-1;i>=0;i--)cout<<s[i];
cout<<"\n";
}
}