#include #define rep(i,a,n) for (int i = a; i < n; i++) #define per(i,n,a) for (int i = n - 1; i >= a; i--) using namespace std; int main() { string s; int a; cin >> s; rep(i, 0, s.size()) { if (s[i] < s[i + 1]) { a = s[i + 1]; } } per(i, s.size(), 0) { if (s[i] == a) { swap(s[0], s[i]); } } cout << s << endl; }