题解 | #字符串排序#
字符串排序
http://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
package main
import (
"fmt"
"io"
"sort"
)
func main() {
var res []string
for {
var s string
_, err := fmt.Scan(&s)
if err == io.EOF {
break
}
res = append(res, s)
}
res = res[1:]
sort.Strings(res)
for i := range res {
fmt.Println(res[i])
}
}