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;
}