题解 | #图片整理#

图片整理

http://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strings"
)

func main() {
	inputReader := bufio.NewReader(os.Stdin)
	for {
		input, err := inputReader.ReadString('\n')
		if err == io.EOF {
			break
		}
		input = strings.Trim(input, "\r\n")
		inputSlice := make([]int, 0)
		for _, v := range input {
			inputSlice = append(inputSlice, int(v))
		}
		sort.Ints(inputSlice)
		res := ""
		for _, v := range inputSlice {
			res += string(v)
		}
		fmt.Println(res)
	}
}
全部评论

相关推荐

但听说转正率很低,我现在有在实习了,好纠结要不要去
熬夜脱发码农:转正率低归低,但是实习的经历你可以拿着,又不是说秋招不准备了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务