class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
dic = {}
for x in s:
dic[x] = dic.get(x, 0)+1;
for x in t:
if dic.get(x, 0)==0:
return x
else:
dic[x] -= 1
class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
diff = 0
for i in range(len(s)):
diff -= ord(s[i])
diff += ord(t[i])
diff += ord(t[-1])
return chr(diff)
class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
code = 0
for ch in s + t:
code ^= ord(ch)
return chr(code)