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 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>
#include <string.h>

int main(void) {
    char S[200001],T[200001];
    int n,x[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},i,j,ans = 0;
    scanf("%d %d",S,T);
    n = strlen(S);
    for (i = 0;i < n;i++) {
        if (S[i] == 'a') {
            if (x[1] == 0) {
                x[1] = T[i];
            } else {
                if (x[1] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'b') {
            if (x[2] == 0) {
                x[2] = T[i];
            } else {
                if (x[2] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'c') {
            if (x[3] == 0) {
                x[3] = T[i];
            } else {
                if (x[3] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'd') {
            if (x[4] == 0) {
                x[4] = T[i];
            } else {
                if (x[4] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'e') {
            if (x[5] == 0) {
                x[5] = T[i];
            } else {
                if (x[5] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'f') {
            if (x[6] == 0) {
                x[6] = T[i];
            } else {
                if (x[6] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'g') {
            if (x[7] == 0) {
                x[7] = T[i];
            } else {
                if (x[7] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'h') {
            if (x[8] == 0) {
                x[8] = T[i];
            } else {
                if (x[8] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'i') {
            if (x[9] == 0) {
                x[9] = T[i];
            } else {
                if (x[9] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'j') {
            if (x[10] == 0) {
                x[10] = T[i];
            } else {
                if (x[10] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'k') {
            if (x[11] == 0) {
                x[11] = T[i];
            } else {
                if (x[11] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'l') {
            if (x[12] == 0) {
                x[12] = T[i];
            } else {
                if (x[12] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'm') {
            if (x[13] == 0) {
                x[13] = T[i];
            } else {
                if (x[13] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'n') {
            if (x[14] == 0) {
                x[14] = T[i];
            } else {
                if (x[14] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'o') {
            if (x[15] == 0) {
                x[15] = T[i];
            } else {
                if (x[15] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'p') {
            if (x[16] == 0) {
                x[16] = T[i];
            } else {
                if (x[16] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'q') {
            if (x[17] == 0) {
                x[17] = T[i];
            } else {
                if (x[17] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'r') {
            if (x[18] == 0) {
                x[18] = T[i];
            } else {
                if (x[18] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 's') {
            if (x[19] == 0) {
                x[19] = T[i];
            } else {
                if (x[19] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 't') {
            if (x[20] == 0) {
                x[20] = T[i];
            } else {
                if (x[20] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'u') {
            if (x[21] == 0) {
                x[21] = T[i];
            } else {
                if (x[21] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'v') {
            if (x[22] == 0) {
                x[22] = T[i];
            } else {
                if (x[22] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'w') {
            if (x[23] == 0) {
                x[23] = T[i];
            } else {
                if (x[23] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'x') {
            if (x[24] == 0) {
                x[24] = T[i];
            } else {
                if (x[24] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'y') {
            if (x[25] == 0) {
                x[25] = T[i];
            } else {
                if (x[25] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        } else if (S[i] == 'z') {
            if (x[0] == 0) {
                x[0] = T[i];
            } else {
                if (x[0] != T[i]) {
                    ans = 1;
                    break;
                }
            }
        }
    }
    for (i = 0;i < 25;i++) {
        for (j = i + 1;j < 26;j++) {
            if (x[i] != '0' && x[j] != '0' && x[i] == x[j]) ans = 1;
        }
    }
    if (ans == 0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}