- Counter 메소드끼리 뺄셈을 이용함.
- elements함수로 Counter의 숫자만큼 요소를 list형태로 반환 받은 후, join함수를 사용하여 문자열 형태로 return함.
from collections import Counter
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
cs = Counter(s)
ct = Counter(t)
return ''.join(list((ct - cs).elements()))