def char_counter(S:str): cc = {} for s in S: cc.setdefault(s,0) cc[s]+=1 return cc A = input() B = input() is_eql = A == B or char_counter(A) == char_counter(B) print("YES" if is_eql else "NO")