import std.stdio, std.string, std.conv ,std.array,std.algorithm, std.range ,std.math; void main(){ auto N = readln().strip().to!string().array(); dchar[] sorted = N.dup; auto ind = iota(0, N.length).array(); sorted.sort!("a > b")(); int i = 0; while(i < N.length && N[i] == sorted[i]) ++i; int p; if ( i != N.length ) { foreach_reverse(immutable int j; 0 .. N.length.to!int){ if(sorted[i] == N[j]) { p = j; break; } } swap(N[i], N[p]); } writeln(N); return; }