Console.Write("The number of names is ");
string[] names = new string[int.Parse(Console.ReadLine())];
Console.WriteLine("Enter the names: ");
for(int i = 0; i < names.Length; i++)
names[i] = Console.ReadLine();
static string[] Sort(string[] arr)
for(int i = 1; i < arr.Length; i++)
string newValue = arr[i];
for(j = i - 1; j >= 0; j--)
if(arr[j].Length > newValue.Length)
static void Output(string[] names)
for(int i = 0; i < names.Length - 1; i++)
if(names[i].Length == names[i + 1].Length)
if(names[i].CompareTo(names[i + 1]) > 0)
Console.WriteLine("The sorted names are: {0}.", String.Join(" ", names));
public static void Main()