#include <stdio.h>
#include <string.h>
#include <stdlib.h> typedef struct student {
char *name;
}; void scan(student stu[], int &n){
char str[];
scanf("%d", &n);
for(int i = ; i < n; ++i){
scanf("%s", str);
int len = strlen(str);
stu[i].name = (char *)malloc((len + ) * sizeof(char));
strcpy(stu[i].name, str);
}
} void print(student stu[], int n){
printf("%d\n", n);
for(int i = ; i < n; ++i){
printf("%s ", stu[i].name);
}
puts("");
}
//按字典序 排序
int comp(const void *a, const void *b){
student *numa = (student *)a, *numb = (student *)b;
return strcmp(numa->name, numb->name);
} int main(){
int n;
student stu[];
scan(stu, n); print(stu, n); qsort(stu, n, sizeof(student), comp); print(stu, n);
return ;
}
/*
10
9只小昆虫
8只小昆虫
7只小昆虫
6只小昆虫
5只小昆虫
4只小昆虫
3只小昆虫
2只小昆虫
1只小昆虫
0只小昆虫 */