题解 | #图片整理#冒泡&QUICK SORT
图片整理
http://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941
#include <string>
#include <vector>
#include <algorithm>
//Lily上课时使用字母数字图片教小朋友们学习英语单词,
//每次都需要把这些图片按照大小(ASCII码值从小到大)排列收好。请大家给Lily帮忙,通过代码解决。
//Lily使用的图片使用字符"A"到"Z"、"a"到"z"、"0"到"9"表示。
using namespace std;
//一行,一个字符串,字符串中的每个字符表示一张Lily使用的图片。
//Lily的所有图片按照从小到大的顺序输出
//方法1:冒泡排序
// int main()
// {
// string str;
// getline(cin,str);
// int len= str.length();
// for(int i=0;i<len;i++)
// {
// for(int j=1; j<len; j++)
// {
// if(str[j] < str[j-1])
// {
// swap(str[j-1], str[j]);//冒泡排序
// }
// }
// }
// cout<<str<<endl;
// return 0;
// }
//方法2:QUICK Sort排序
int main()
{
string str;
getline(cin,str);
sort(str.begin(),str.end());
cout<<str<<endl;
return 0;
}