#C4750. Isomorphic Strings
Isomorphic Strings
Isomorphic Strings
Two strings \( s_1 \) and \( s_2 \) are said to be isomorphic if there exists a one-to-one mapping between every character of \( s_1 \) and every character of \( s_2 \), with no two characters mapping to the same character and vice versa. In other words, all occurrences of a character in \( s_1 \) can be replaced with another character to yield \( s_2 \), while preserving the order. Your task is to determine whether the given two strings are isomorphic.
Note: The mapping must be bijective. For example, "egg" and "add" are isomorphic, but "foo" and "bar" are not.
inputFormat
The input consists of two lines:
- The first line contains the string \( s_1 \).
- The second line contains the string \( s_2 \).
Both strings can include any characters and may be empty.
outputFormat
Output a single line: True
if the two strings are isomorphic, or False
otherwise.
egg
add
True