超排序

TimeLimit: 1000MS Memory Limit: 65536KB

SubmitStatistic

ProblemDescription

bLue在跨年之际获得了一份小礼物,里面装了一串只包含大写字母和小写字母的字符串,如果你能帮bLue把这个字符串按照字典序排序(按ASCII码从小到大排序。大写字母的ASCII码小于小写字母的ASCII码),他会奖励你一个Accepted

Input

输入数据有多组(数据组数不超过50),到EOF结束。

对于每组数据,输入一行只包含大写字母和小写字母的字符串,且长度不超过1000000

Output

对于每组数据,输出一行排序后的字符串。

ExampleInput

HappyNewYear

aaabAAbbBcdAB

ExampleOutput

HNYaaeepprwy

AAABBaaabbbcd

Hint

由于数据量较大,不推荐直接使用cin,cout 输入输出。

另外,请确保最终结果是直接输出整个字符串,而非使用printf("%c")putchar()等函数一个一个地输出字符,否则可能导致超时。

Author

SDUTRound #1 - Hello 2017 跨年大作战」bLue

#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{

    char num;

    char a[1000002];
    while(~scanf("%s",a))
    {
        int tu[300]={0};
        for(int i=0;a[i];i++)
        {
            tu[a[i]]++;
        }
        for(int i='A';i<='Z';i++)
        {
        for(int j=1;j<=tu[i];j++)
        {
            printf("%c",i);
        }
        }
         for(int i='a';i<='z';i++)
        {
        for(int j=1;j<=tu[i];j++)
        {
            printf("%c",i);
        }
        }
        cout<<endl;

    }

    return 0;
}


/***************************************************
User name: jk160505徐红博
Result: Accepted
Take time: 524ms
Take Memory: 1124KB
Submit time: 2017-02-22 20:11:00
****************************************************/