12345678910111213141516171819 |
- package kata
- import "unicode"
- func duplicate_count(s1 string) int {
- hits := make(map[rune]int)
- for _, r := range s1 {
- l := unicode.ToLower(r)
- n, _ := hits[l]
- hits[l] = n + 1
- }
- count := 0
- for _, n := range hits {
- if n > 1 {
- count++
- }
- }
- return count
- }
|