Pseudo-Isomorphic Substrings

  • + 1 comment
    def pseudoIsomorphicSubstrings(s):
        # Write your code here
        def cod(w):
            c, n, d = '', ord('a') - 1, {}
            for letter in w:
                if letter in d.keys():
                    c += d[letter]
                else:
                    n += 1
                    c += chr(n)
                    d[letter] = chr(n)
            return c