100knock #02

Run Settings
LanguageGo
Language Version
Run Command
package main import ( "fmt" "unicode/utf8" ) func joinWord(word1 string, word2 string) string { words := make([]rune, utf8.RuneCountInString(word1)+utf8.RuneCountInString(word2)) i := 0 for len(word1) > 0 || len(word2) > 0 { if len(word1) > 0 { runeValue, size := utf8.DecodeRuneInString(word1) words[i] = runeValue word1 = word1[size:] i++ } if len(word2) > 0 { runeValue, size := utf8.DecodeRuneInString(word2) words[i] = runeValue word2 = word2[size:] i++ } } return string(words) } func main() { word1 := "パトカー" word2 := "タクシー" fmt.Println(joinWord(word1, word2)) }
Editor Settings
Theme
Key bindings
Full width
Lines