D 字符串排序
题目描述
输入一个字符串,长度小于等于200,然后将输出按字符顺序升序排序后的字符串。
输入
测试数据有多组,输入字符串。
输出
对于每组输入,输出处理后的结果。
样例输入
tianqin
样例输出
aiinnqt
提示
注意输入的字符串中可能有空格。
#include <iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
using namespace std;
int main(int argc, char *argv[]) {
char str[200];
while(gets(str))
{
sort(str, str + strlen(str));
cout<<str<<endl;
}
return 0;
}