# https://leetcode.com/problems/find-the-difference/
    
# Given two strings s and t which consist of only lowercase letters.

# String t is generated by random shuffling string s and then add one more letter at a random position.

# Find the letter that was added in t.

class Solution:
    def findTheDifference(self, s: str, t: str) -> str:
        ds, dt = defaultdict(int), defaultdict(int)

        for i in range(len(s)):
            ds[s[i]] += 1
            dt[t[i]] += 1
            
        dt[t[-1]] += 1
        
        for key, value in dt.items():
            if value != ds[key]:
                return key
