#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	string str;
	cin >> str;
	char ma = *max_element(str.begin(), str.end());
	for (int i = (int)str.size() - 1; i >= 0; i--){
		if (ma == str[i]){
			swap(str[0], str[i]);
			break;
		}
	}
	
	cout << str << endl;
	return 0;
}