当前位置: 代码迷 >> 综合 >> 题目1054:字符串内排序 九度OJ
  详细解决方案

题目1054:字符串内排序 九度OJ

热度:95   发布时间:2023-09-24 07:09:25.0

题目1054:字符串内排序

时间限制:1 秒

内存限制:32 兆

特殊判题:

提交:12062

解决:6445

题目描述:

输入一个字符串,长度小于等于200,然后将输出按字符顺序升序排序后的字符串。

输入:

测试数据有多组,输入字符串。

输出:

对于每组输入,输出处理后的结果。

样例输入:
bacd
样例输出:
abcd
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=200;
bool cmp(char x,char y){return x<y;
}
int main(){char a[N];while(scanf("%s",a)!=EOF){sort(a,a+strlen(a),cmp);cout<<a<<endl;	} return 0;
}