Counting Duplicates

Python

from collections import Counter

def duplicate_count(text):
    if not text: return 0
    frequencies = Counter(text.lower())
    return len(list(
        filter(lambda x: x > 1, frequencies.values())
    ))

Tags

  1. python (Private)
  2. 6-kyu (Private)
  3. codewars (Private)
  4. answer (Private)