📅  最后修改于: 2022-03-11 14:48:46.598000             🧑  作者: Mango
int n = Convert.ToInt32(Console.ReadLine());
string[] a = new string[n];
for (int i = 0; i < n; i++)
a[i] = Console.ReadLine();
Array.Sort(a, (left, right) => {
if (left.Length != right.Length)
return left.Length - right.Length;
else
return string.CompareOrdinal(left, right); // left.CompareTo(right) is too slow
});
for (int i = 0; i < n; i++)
Console.WriteLine(a[i]);