package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func getInputTxt() []byte {
var str []byte
reader := bufio.NewReader(os.Stdin)
inputText, _ := reader.ReadString('\n')
str = []byte(strings.TrimSuffix(inputText, "\n"))
return str
}
func checkChar(b byte) bool {
if (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') {
return true
} else {
return false
}
}
func compare(a, b byte) bool{
aTemp := strings.ToUpper(string(a))
bTemp := strings.ToUpper(string(b))
if aTemp[0] > bTemp[0] {
return true
} else {
return false
}
}
func main() {
str := getInputTxt()
strLen := len(str)
for i:= 0; i < strLen - 1; i++ {
maxIndex := 0 // 只比较相邻的两个字符,谁大谁靠后。内层循环其实跟i没关系,只是作为计数
// str[i]是字母
for j:= 0; j < strLen - i; j++ {
if checkChar(str[j]) {
// str[j]也是字母
if (compare(str[maxIndex], str[j])) {
str[maxIndex], str[j] = str[j], str[maxIndex]
}
maxIndex = j
}
}
}
fmt.Println(string(str))
}