class Problem0064:
    def solve(this):
        a = list(input())
        b = list(input())
        a.sort()
        b.sort()

        if a == b:
            print("YES")
        else:
            print("NO")

if __name__ == "__main__":
    problem = Problem0064()
    problem.solve()