SDE Path

Check if Two Strings Are Isomorphic

Easy

Check if Two Strings Are Isomorphic

Determine if the characters in string A can be mapped one-to-one to characters in string B.

Input format

Two lines, each containing one lowercase string. The strings have equal length.

Output format

Print true if the strings are isomorphic (a one-to-one character mapping converts one into the other), otherwise false.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
egg add
Expected output
true
Example 2
Input
foo bar
Expected output
false