使用冒泡排序
#include<iostream>
#include<vector>
using namespace std;
//判断是否为字母
bool isletter(char c)
{
if((c>='A'&&c<='Z')||(c>='a'&&c<='z'))
return true;
else
return false;
}//end func</vector></iostream>

bool compare(char a,char b)
{
//转换成大写字母比较
a=(a>='a'?char(int('A')+a-'a'):a);
b=(b>='a'?char(int('A')+b-'a'):b);
if(a>b)
return true;
if(a<=b)
return false;
}//end func

int main()
{
string s;
while (getline(cin,s))
{
vector<int> index;
//记录字符串中字母的坐标
for (int i = 0; i < s.size(); i++)
{
if (isletter(s[i]))
index.push_back(i);
}
//冒泡排序
for (int i = 0; i < index.size() - 1; i++)
{
for (int j = 0; j < index.size() - i - 1; j++)
{
if (compare(s[index[j]], s[index[j + 1]]))
{
char tmp;
tmp = s[index[j]];
s[index[j]] = s[index[j + 1]];
s[index[j + 1]] = tmp;
}//end if
} //end for
}//end for
cout << s << endl;
}
}</int>