• + 0 comments

    cool solution using Counter

    from collections import Counter
    n = int(input())
    words = [input() for _ in range(n)]
    c = Counter(words)
    print(len(c))
    print(*c.values())