#C8762. String Transformation

    ID: 52780 Type: Default 1000ms 256MiB

String Transformation

String Transformation

You are given two strings S and T consisting of lowercase English letters. Your task is to determine whether it is possible to transform S into T by applying a bijective character mapping. In other words, you need to check if there exists a one-to-one correspondence (a bijection) f such that for every valid index i,

f(Si)=Tif(S_i) = T_i

The transformation is only possible if the following conditions hold:

  • The lengths of S and T are equal, i.e. $$|S| = |T|.$$
  • Each character in S consistently maps to the corresponding character in T and no two different characters in S map to the same character in T (ensuring the mapping is bijective).

If both conditions are satisfied, output YES; otherwise, output NO.

Note: The constraints are $$1 \leq |S|, |T| \leq 10^5$$.

inputFormat

The input is read from stdin and consists of two lines:

  1. The first line contains the string S.
  2. The second line contains the string T.

outputFormat

Output a single line to stdout containing YES if it is possible to transform S into T using a bijective mapping, or NO if it is not possible.

## sample
abc
def
YES