Problem Description
Enter n (n<100) strings, each with a length of not more than 1000, to output them in dictionary order.
Input
Example of multi-group test sample. The first row of each group has an integer n indicating that there are n strings. Next there are n rows, one string per line.
Output
Output a sequential string, with each line outputting a string.
Sample Input
3abaaabcab
Sample Output
Aababacab
1#include <stdio.h>2#include <string.h>3 voidSortChar* str[],intsize)4 {5 inti,j;6 Char*tmp;7 for(i=0; i<size-1; i++)8 {9 for(j=i+1; j<size;j++)Ten { One if(strcmp (str[i],str[j]) >0) A { -tmp=Str[i]; -str[i]=Str[j]; thestr[j]=tmp; - } - } - } + } - + voidMain () A { at Charstr[ -][ +]; - Char* p[ -]; - intI,n; - while(SCANF ("%d", &n)! =EOF) - { - for(i=0; i<n;i++) in { -scanf"%s", Str[i]); top[i]=Str[i]; + } - sort (p,n); the for(i=0; i<n;i++) *printf"%s\n", P[i]); $ }Panax Notoginseng}
Wuhan University of Science and Technology acm:1007: Chinese Edition C language Programming tutorial (second edition) Exercise 7.10