#include <string>
#include <iostream>
using namespace std;
class SwappingDigits
{
public:
bool notBiggest(string &s,int pos)
{
int len=s.length();
int i=;
for (i=pos+;i<len;i++)
{
if (s[i]<s[pos]&&(s[i]!=''||pos!=))
{
return true;
}
}
return false;
}
int findSmallest(string&s,int pos)
{
int len=s.length();
int i=;
char c='';
int index;
for (i=len-;i>pos;i--)
{
if (s[i]<c&&(s[i]!=''||pos!=))
{
c=s[i];
index=i;
}
}
return index;
}
string minNumber(string num)
{
int i;
int len=num.length();
for (i=;i<len-;i++)
{
if (notBiggest(num,i))
{
int index=findSmallest(num,i);
char c=num[index];
num[index]=num[i];
num[i]=c;
break;
}
}
return num;
}
};
int main()
{
SwappingDigits sol;
string s;
while(true)
{
cin>>s;
cout<<sol.minNumber(s)<<endl;
}
}