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 C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using static System.Console;
using static PB10004.Algorithm.Util;

namespace PB10004.Algorithm
{
    class Template
    {
        static void Main(string[] args)
        {
            new C().Solve();
        }
    }
    class A{
        public void Solve(){
            var array = ReadIntArray();
            Array.Sort(array);
            WriteLine(array[2]*10 + array[0] + array[1]);
        }
    }
    class B{
        public void Solve(){
            var array = ReadIntArray();
            var X = array[2];
            var Y = array[3];
            var xs = ReadIntArray();
            var ys = ReadIntArray();
            var xmax = xs.Max();
            var ymin = ys.Min();
            if(xmax < ymin && ((xmax+1 <= Y && xmax+1 > X) || (ymin > X && ymin <= Y))) WriteLine("No War");
            else WriteLine("War");
        }
    }
    class C{
        public void Solve(){
            var S = ReadLine();
            var T = ReadLine();
            char[] array = new char[26];
            char[] array2 = new char[26];
            char[] a = S.OrderBy(x=>x).ToArray();
            char[] b = T.OrderBy(x=>x).ToArray();
            if(S == T){
                WriteLine("Yes");
                return;
            }
            for(int i=0;i<S.Length;i++){
                if(S[i] != T[i]){
                    int id = S[i] - 'a';
                    int id2 = T[i] - 'a';
                    if(array[id] != default(char) && array[id] != T[i]){
                        WriteLine("No");
                        return;
                    }
                    else{
                        array[id] = T[i];
                    }
                    if(array2[id2] != default(char) && array2[id2] != S[i]){
                        WriteLine("No");
                        return;
                    }
                    else{
                        array2[id2] = S[i];
                    }
                }
            }
            int tmp = 100;
            int count = 0;
            while(tmp != default(int) && count < 26){
                if(tmp==100) tmp=0;
                tmp = (int)array[tmp] - 'a';
                count++;
            }
            if(count == 26) WriteLine("No");
            else WriteLine("Yes");
        }
    }
    class D{
        const int MAX = 1000000007;
        ulong[,] dp;
        public void Solve(){
            var array = ReadLongArray();
            var N = array[0];
            var M = array[1];
            dp = new ulong[N+1, M+1];
            WriteLine(Calc(N,M));
        }
        ulong Calc(long N, long M){
            if(N == 0) return 0;
            if(N == 1) return 1;
            if(dp[N, M] != default(ulong)) return dp[N,M];
            ulong count = 0;
            for(long i=1;i <= Math.Sqrt(M);i++){
                if(M%i == 0){
                    count += Calc(N-1, i)+ Calc(N-1, M/i);
                    count = count % MAX;
                }
            }
            dp[N,M] = count;
            return count;
        }
    }
    public static class Util
    {
        /// <summary>
        /// 標準入力をint型にパースする
        /// </summary>
        /// <returns></returns>
        public static int ReadInt(){
            return int.Parse(ReadLine());
        }
        /// <summary>
        /// 標準入力をint型の配列にする
        /// </summary>
        /// <returns></returns>
        public static int[] ReadIntArray(){
            return ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
        }
        /// <summary>
        /// 標準入力をlong型にパースする
        /// </summary>
        /// <returns></returns>
        public static long ReadLong()
        {
            return long.Parse(ReadLine());
        }
        /// <summary>
        /// 標準入力をlong型の配列にする
        /// </summary>
        /// <returns></returns>
        public static long[] ReadLongArray()
        {
            return ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        /// <summary>
        /// 一定値の数列を生成する
        /// </summary>
        /// <param name="value"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static IEnumerable<long> ConstSeq(long value, long length)
        {
            for (int i = 0; i < length; i++)
            {
                yield return value;
            }
        }
        /// <summary>
        /// int配列の累積和を求める
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static IEnumerable<int> CumulativeSum(IEnumerable<int> array)
        {
            int tmp = 0;
            foreach (var num in array)
                yield return tmp += num;
        }
        /// <summary>
        /// long配列の累積和を求める
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static IEnumerable<long> CumulativeSum(IEnumerable<long> array)
        {
            long tmp = 0;
            foreach (var num in array)
                yield return tmp += num;
        }
        /// <summary>
        /// 最大公約数をユークリッドの互除法で求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }
        /// <summary>
        /// 最小公倍数を求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }
    }
}