
###389. Find the Difference


题目:
<https://leetcode.com/problems/find-the-difference/>


难度:

Easy


思路

用两个hashmap分别来记录 s 和 t 中char的数量，一旦t[key] > s[key], output

注意这个好的写法


mapt[char] = mapt.get(char,0) + 1 

如果mapt[char]不存在，会默认给1



```
class Solution(object):
    def findTheDifference(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: str
        """
        maps = {}
        mapt = {}
        for char in s:
        	maps[char] = maps.get(char,0) + 1
        for char in t:
        	mapt[char] = mapt.get(char,0) + 1

        for key in mapt:
        	if mapt[key] - maps.get(key,0) > 0:
        		return key
```


