Problem library

Roster Order

Easy
sorting

A team page lists player names shortest first. Names of equal length are listed alphabetically, and names that differ only in letter case keep the order they had in names: compare names ignoring case, and treat a tie as already sorted.

Return the names in roster order.

Examples

Input: names = ["Zed","amy","Bo","al"]
Output: ["al","Bo","amy","Zed"]
Input: names = ["Kai","kai","KAI"]
Output: ["Kai","kai","KAI"]