class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
aDic={}
bDic={}
for i in range(len(s)):
a=aDic.get(s[i])
b=bDic.get(t[i])
if not a and not b:
aDic[s[i]]=t[i]
bDic[t[i]]=s[i]
elif a!=t[i] and b!=s[i]:
return False
return True
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
aDic={}
bDic={}
for i in range(len(s)):
a=aDic.get(s[i])
b=bDic.get(t[i])
if not a and not b:
aDic[s[i]]=t[i]
bDic[t[i]]=s[i]
elif a!=t[i] and b!=s[i]:
return False
return True