Question
Language : C One night, Lili was staring at a collection of letters a - z lying on the table. At first Lili just moved
Language : C
One night, Lili was staring at a collection of letters a - z lying on the table. At first Lili just moved the letters randomly until the letters formed a square grid, then Lili thought of an interesting problem. Right now, Lili has a grid of letters that is R x C. Lili will do sorting 2 times. In the first sorting, Lili will sort the letters ascending lexicographically from left to right. In the second sorting, Lili will sort the words sorted before descending lexicographically. Example: dea efb gbe First ordering: ade bef beg Second Ordering: beg bef ade
Format Input : There are integers R and C in the first line. Then there are R lines, each of which contains C letters.
Format Output : Take out the R x C grid which is the sorted letter.
Constraints : 1 R, C 200
Sample Input (standard input) : 3 3 asj efd gza
Sample Output (standard output) : def ajs agz
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started