题面
#include<stdio.h>
/********** Specification of mysort **********/
void mysort(char *v[], int L, int R);
/* PreCondition:
v points to an array of char*,
L,R are indexes of the array to be sorted
PostCondition:
sort v with the ascending order of strings
pointed by elements of the array pointed by v
*/
#define MAXLINES 5000
char *lineptr[MAXLINES];
void readlines(char *lineptr[], int nlines);
void writelines(char *lineptr[], int nlines);
int main() {
int nlines;
scanf("%d\n", &nlines);
readlines(lineptr, nlines);
/********** mysort is called here *************************/
mysort(lineptr, 0, nlines - 1);
/***********************************************************/
writelines(lineptr, nlines);
return 0;
}
输入格式
- Line 1: ().
- Line 2~: A non-empty string each line. Sum of lengths of all strings will not exceed .
输出格式
Output the sorted strings.
样例
输入
7 a b c d ef ee bb
输出
a b bb c d ee ef