using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "Input4"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("12"); //21 } else if (InputPattern == "Input2") { WillReturn.Add("21"); //21 } else if (InputPattern == "Input3") { WillReturn.Add("1122"); //2211 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); string NStr = InputList[0]; char[] StrArr = NStr.ToCharArray(); Array.Sort(StrArr, (A, B) => B.CompareTo(A)); var sb = new System.Text.StringBuilder(); Array.ForEach(StrArr, X => sb.Append(X)); Console.WriteLine(sb.ToString()); } }