题解 | #图片整理#
图片整理
http://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941
输入字符串,简单的冒泡排序
include
include
using namespace std;
int main()
{
string str;
while(cin>>str)
{
for(int i = 0;i<str.size()-1;i++)
{
for(int j = 0;j<str.size()-1;j++)
{
if(str[j]>str[j+1])
{
char tem = str[j];
str[j] = str[j+1];
str[j+1] = tem;
}
}
}
cout<<str<<endl;
}
}