版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
package com.tree;
import java.util.Scanner;
/**
* @Auther: 大哥的叔
* @Date: 2019/9/26 19:24
* @Description:
*/
public class Main1 {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
char[] c = str.toCharArray();
BubbleSort(c);
str = str.valueOf(c);
System.out.println(str);
}
public static void BubbleSort (char[] ch) {
char temp = 0;
for (int i = 0; i < ch.length - 1; i++) {
for (int x = 0; x < ch.length - 1 - i; x++) {
if (ch[x] > ch[x + 1]) {
temp = ch[x + 1];
ch[x + 1] = ch[x];
ch[x] = temp;
}
}
}
}
}