from collections import Counter
def solution(topping):
answer = 0
Dict = Counter(topping)
sets = set()
for i in topping:
sets.add(i)
Dict[i] -= 1
if Dict[i] == 0:
Dict.pop(i)
if len(sets) == len(Dict):
answer += 1
return answer
Counter() 함수를 활용하여 문제를 해결할 수 있다.