Problem
Determine whether two equal-length strings are isomorphic: one consistent character replacement maps s to t in order. Every occurrence of a source character uses the same target character, and two different source characters cannot map to the same target character. A character may map to itself.
bool isIsomorphic(string s, string t);
Examples
Input: s = "xyx", t = "aba"
Output: true
Input: s = "ab", t = "cc"
Output: false
Two different source characters cannot both map to c.
Constraints
-
Both lengths are equal and between 1 and 50000.
-
Any valid ASCII character may occur, including control characters; the domain is not restricted to letters or printable ASCII.