using System; using System.Linq; namespace No39_1{ public class Program{ public static void Main(string[] args){ var n = Console.ReadLine().ToCharArray(); var length = n.Length; var max = 0; for(var i = 0; i < length; i++){ for(var j = i; j < length; j++){ var tmp = new char[length]; n.CopyTo(tmp, 0); var t = tmp[i]; tmp[i] = tmp[j]; tmp[j] = t; string str = tmp.Aggregate(string.Empty, (current, c) => current + c); max = Math.Max(max, int.Parse(str)); } } Console.WriteLine(max); } } }