#K78972. Are Isomorphic Strings
Are Isomorphic Strings
Are 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\), preserving the order. More formally, there is a bijection \(f: \Sigma \to \Sigma\) such that for every index \(i\), \(f(s_1[i]) = s_2[i]\). This problem requires you to determine whether two given strings are isomorphic. For example:
egg
andadd
are isomorphic.foo
andbar
are not isomorphic.
You need to read the input from standard input and print the result to standard output.
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 will be non-empty and contain only printable characters.
outputFormat
Output a single line containing either True
if the two strings are isomorphic, or False
otherwise.
egg
add
True