Created
March 28, 2018 05:14
-
-
Save halllllll/4ae175d17fee528995a73397c7730c68 to your computer and use it in GitHub Desktop.
nihongo is muzukasii-
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sort" | |
"strings" | |
) | |
func main(){ | |
message := "いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑいもせす" | |
lnh := len([]rune(message)) | |
ms := make([]string, lnh) | |
for i, v := range []rune(message){ | |
ms[i] = string(v) | |
} | |
fmt.Println(ms) | |
sort.Strings(ms) | |
fmt.Println(ms) | |
fmt.Println(strings.Join(ms, "")) | |
sort.Sort(sort.Reverse(sort.StringSlice(ms))) | |
fmt.Println(ms) | |
fmt.Println(strings.Join(ms, "")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment