• + 2 comments

    StringComparison.Ordinal is what you want to do for your string comparisons in C#. When performing a compare with StringComparison.Ordinal the RAW bytes are used to compare strings rather than some weird Culture-Info check remarks

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    class Solution {
        
        static void Main(String[] args) {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] unsorted = new string[n];
            for(int unsorted_i = 0; unsorted_i < n; unsorted_i++){
               unsorted[unsorted_i] = Console.ReadLine();   
            }
            Array.Sort(unsorted,(string a,string b) => {
                if(a.Length == b.Length)
                    return string.Compare(a,b,StringComparison.Ordinal);
                return a.Length - b.Length;
            });
            Console.WriteLine(string.Join("\n",unsorted));
        }
    }