#C7058. Isomorphic Strings

    ID: 50887 Type: Default 1000ms 256MiB

Isomorphic Strings

Isomorphic Strings

You are given two strings s and t. Two strings are said to be isomorphic if there exists a one-to-one mapping between every character of s and every character of t such that replacing each character in s according to the mapping yields t. In other words, if s and t have lengths n, then there exists a bijective function \( f: \Sigma \to \Sigma \) such that for every index \( i \) (where \( 1 \le i \le n \)) we have \( f(s_i) = t_i \). If the strings have different lengths, they cannot be isomorphic.

Example:

  • For s = "egg" and t = "add", the mapping \( e \to a, g \to d \) makes the strings isomorphic.
  • For s = "foo" and t = "bar", no such one-to-one mapping exists.

Your task is to determine whether the two given strings are isomorphic.

inputFormat

The input consists of two lines:

  • The first line contains the string s.
  • The second line contains the string t.

Both strings can consist of any characters.

outputFormat

Output a single line: True if the two strings are isomorphic, or False otherwise.

## sample
egg
add
True