Please use C language
Introduction:
Input:
Output:
Example:
Given n strings, each of which consists of m uppercase letters, your task is to sort them in ascending order according to the following comparison method. If the first position that string a and string b differs is i, then a is smaller than biff 1. i is odd and a; <bi, or 2. i is even and ai > bi. The comparison of a¡ and bị follows A<B<C<D< ... <Z. An example: AC < AB < AA <BC<BB <BA.
Two numbers in the first line: n and m (1 <nim < 106). The following n lines gives n strings that are pairwise distinct.
The indices of the strings after sorting.
Input: 54 AAAA AABB AABC ABAA BACC Output: 413 2 5 (ABAA < AAAA< AABC < AABB < BACC)
Please use C language Introduction: Input: Output: Example:
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am