Topic 1066: Sorting strings
time limit:1 seconds
Memory limit:32 MB
Special question: No
submitted:4919
Resolution:1983
-
Title Description:
-
Enter a string of not more than 20 length, the input string, according to the size of the ASCII code from small to large to sort, please output sorted results
-
Input:
-
A string whose length is n<=20
-
Output:
-
The input sample may have more than one set, for each test sample,
Sorts the input string from small to large according to the size of the ASCII code, outputting the sorted result
-
Sample input:
-
Dcba
-
Sample output:
-
Abcd
#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm>using namespace Std;char a[21];int Main (int argc, char *argv[]) {while (~scanf ("%s", a)) { sort (A,a+strlen (a)); printf ("%s\n", a); } return 0;} /************************************************************** problem:1066 user:kirchhoff language:c++ result:accepted time:90 Ms memory:1520 kb
Nine degrees OJ 1066 string sort