1927 Problem D 字符串内排序

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a845717607/article/details/89415180

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

猜你喜欢

转载自blog.csdn.net/a845717607/article/details/89415180