View Code
1 #include2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 char str[100010][101]; 8 int cmp(const void *s1,const void *s2) 9 {10 return(strcmp((char*)s1,(char*)s2));11 }12 int main()13 {14 char c;15 16 int flag=1;17 int n=0,k=0,i;18 char str1[101];19 while(~scanf("%c",&c))20 {21 if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))22 {23 flag=0;24 if(c<='Z'&&c>='A')25 str[n][k]=c+32;26 else27 str[n][k]=c;28 k++;29 }30 else31 {32 if(flag==0)33 {34 str[n][k]='\0';35 n++;36 k=0;37 }38 flag++;39 }40 }41 qsort(str,n,sizeof(str[0]),cmp);//快排对字符串排序42 strcpy(str1,str[0]);43 puts(str[0]);44 for(i=1;i