import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto S = readln.chomp;
    auto T = readln.chomp;
    foreach (i; 0..S.length) {
        if (S[i] == T[i]) continue;
        S = S
            .replace(S[i..i+1], "_")
            .replace(T[i..i+1], S[i..i+1])
            .replace("_", T[i..i+1]);
    }
    writeln(S == T ? "Yes" : "No");
}

