class Problem0064: def solve(this): res = {} for ch in list(input()): res[ch] = res.get(ch, 0) + 1 for ch in list(input()): res[ch] = res.get(ch, 0) + 1 for v in res.values(): if v != 2: print("NO") return print("YES") if __name__ == "__main__": problem = Problem0064() problem.solve()