Wuhan University of Science and Technology acm:1007: Chinese Edition C language Programming tutorial (second edition) Exercise 7.10

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.