k.go 255 B

123456789101112131415
  1. package kata
  2. import (
  3. "strings"
  4. "unicode"
  5. )
  6. func Accum(s string) string {
  7. var sl []string
  8. for i, r := range s {
  9. s = string(unicode.ToUpper(r))
  10. sl = append(sl, s + strings.Repeat(string(unicode.ToLower(r)), i))
  11. }
  12. return strings.Join(sl, "-")
  13. }