問題 D: 字符串內排序
時間限制: 1 Sec 內存限制: 32 MB
題目描述
輸入一個字符串,長度小於等於200,然後將輸出按字符順序升序排序後的字符串。
輸入
測試數據有多組,輸入字符串。
輸出
對於每組輸入,輸出處理後的結果。
樣例輸入
tianqin
樣例輸出
aiinnqt
提示
注意輸入的字符串中可能有空格。
經驗總結
基礎題~~詳見代碼~
AC代碼
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
char s[210];
while(gets(s))
{
sort(s,s+strlen(s));
printf("%s\n",s);
}
return 0;
}