Problem:
Score : 300 points

Problem Statement

You are given strings S and T consisting of lowercase English letters.

You can perform the following operation on S any number of times:

Operation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.

Determine if S and T can be made equal by performing the operation zero or more times.

Constraints

1 \leq |S| \leq 2 \times 10^5

|S| = |T|

S and T consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

If S and T can be made equal, print Yes; otherwise, print No.

Sample Input 1

azzel
apple

Sample Output 1

Yes

azzel can be changed to apple, as follows:

Choose e as c_1 and l as c_2. azzel becomes azzle.

Choose z as c_1 and p as c_2. azzle becomes apple.

Sample Input 2

chokudai
redcoder

Sample Output 2

No

No sequences of operation can change chokudai to redcoder.

Sample Input 3

abcdefghijklmnopqrstuvwxyz
ibyhqfrekavclxjstdwgpzmonu

Sample Output 3

Yes

Solution in Ruby (2.3.3) (judge verdict: Accepted)

wo1 = gets.chomp.split("")
wo2 = gets.chomp.split("")
ans = Array.new(26, "+")
leng = wo1.length
count = 0

for i in 0..leng - 1
  if wo1[i] == "a"
    count = 0
  elsif wo1[i] == "b"
    count = 1
  elsif wo1[i] == "c"
    count = 2
  elsif wo1[i] == "d"
    count = 3
  elsif wo1[i] == "e"
    count = 4
  elsif wo1[i] == "f"
    count = 5
  elsif wo1[i] == "g"
    count = 6
  elsif wo1[i] == "h"
    count = 7
  elsif wo1[i] == "i"
    count = 8
  elsif wo1[i] == "j"
    count = 9
  elsif wo1[i] == "k"
    count = 10
  elsif wo1[i] == "l"
    count = 11
  elsif wo1[i] == "m"
    count = 12
  elsif wo1[i] == "n"
    count = 13
  elsif wo1[i] == "o"
    count = 14
  elsif wo1[i] == "p"
    count = 15
  elsif wo1[i] == "q"
    count = 16
  elsif wo1[i] == "r"
    count = 17
  elsif wo1[i] == "s"
    count = 18
  elsif wo1[i] == "t"
    count = 19
  elsif wo1[i] == "u"
    count = 20
  elsif wo1[i] == "v"
    count = 21
  elsif wo1[i] == "w"
    count = 22
  elsif wo1[i] == "x"
    count = 23
  elsif wo1[i] == "y"
    count = 24
  elsif wo1[i] == "z"
    count = 25
  end
  if ans[count] == "+"
    ans[count] = wo2[i]
  else
    if wo2[i] != ans[count]
      puts "No"
      exit
    end
  end
end

ans = Array.new(26, "+")

for i in 0..leng - 1
  if wo2[i] == "a"
    count = 0
  elsif wo2[i] == "b"
    count = 1
  elsif wo2[i] == "c"
    count = 2
  elsif wo2[i] == "d"
    count = 3
  elsif wo2[i] == "e"
    count = 4
  elsif wo2[i] == "f"
    count = 5
  elsif wo2[i] == "g"
    count = 6
  elsif wo2[i] == "h"
    count = 7
  elsif wo2[i] == "i"
    count = 8
  elsif wo2[i] == "j"
    count = 9
  elsif wo2[i] == "k"
    count = 10
  elsif wo2[i] == "l"
    count = 11
  elsif wo2[i] == "m"
    count = 12
  elsif wo2[i] == "n"
    count = 13
  elsif wo2[i] == "o"
    count = 14
  elsif wo2[i] == "p"
    count = 15
  elsif wo2[i] == "q"
    count = 16
  elsif wo2[i] == "r"
    count = 17
  elsif wo2[i] == "s"
    count = 18
  elsif wo2[i] == "t"
    count = 19
  elsif wo2[i] == "u"
    count = 20
  elsif wo2[i] == "v"
    count = 21
  elsif wo2[i] == "w"
    count = 22
  elsif wo2[i] == "x"
    count = 23
  elsif wo2[i] == "y"
    count = 24
  elsif wo2[i] == "z"
    count = 25
  end
  if ans[count] == "+"
    ans[count] = wo1[i]
  else
    if wo1[i] != ans[count]
      puts "No"
      exit
    end
  end
end


puts "Yes"