๐Ÿ“ฆ jtr109 / go-playground

๐Ÿ“„ lib.go ยท 19 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19package mexicanwave

import (
	"fmt"
	"strings"
)

func wave(words string) []string {
	res := []string{}
	for i, r := range words {
		if r == ' ' {
			continue
		}
		newWords := fmt.Sprintf("%s%s%s", words[:i], strings.ToUpper(string(r)), words[i+1:])
		res = append(res, newWords)
	}
	return res
}