#K10871. Isomorphic Strings
Isomorphic Strings
Isomorphic Strings
Given two strings s
and t
, determine if they are isomorphic.
Two strings are isomorphic if there exists a bijection between the characters of s
and t
. In other words, the mapping from the characters of s
to t
is one-to-one and onto. Formally, two strings \( s \) and \( t \) are isomorphic if for every character \( s_i \) in \( s \) there exists a unique character \( t_i \) in \( t \) such that the transformation is consistent over the entire string.
For example, egg
and add
are isomorphic as the mapping \( e \rightarrow a, g \rightarrow d \) is consistent, whereas foo
and bar
are not isomorphic.
inputFormat
The input consists of two non-empty strings separated by whitespace from standard input. Each string is given in a single token.
outputFormat
Output a single line containing either true
if the two strings are isomorphic or false
otherwise.
egg
add
true