package main import ( "bufio" "fmt" "os" "sort" "unicode" ) func main() { in := bufio.NewScanner(os.Stdin) in.Scan() chars := []rune(in.Text()) var letters []rune otherChars := make([]bool, len(chars)) for i, c := range chars { if !unicode.IsLetter(c) { otherChars[i] = true continue } letters = append(letters, c) } sort.SliceStable(letters, func(i, j int) bool { return unicode.ToLower(letters[i]) < unicode.ToLower(letters[j]) }) for i, c := range chars { if otherChars[i] { fmt.Printf("%c", c) continue } fmt.Printf("%c", letters[0]) letters = letters[1:] } }