class Solution:
    def isIsomorphic(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: bool
        """
        if len(s)==0:
            return True
        dict1,dict2={},{}
        for i in range(len(s)):
            if s[i] not in dict1:
                dict1[s[i]]=t[i]
            else:
                if dict1[s[i]]!=t[i]:
                    return False
        for i in range(len(t)):
            if t[i] not in dict2:
                dict2[t[i]]=s[i]
            else:
                if dict2[t[i]]!=s[i]:
                    return False
        return True
s1="egg"
t="add"
s=Solution()
print(s.isIsomorphic(s1,t))
