a=input() b=input() for i in a: c=a.count(i) d=b.count(i) if c!=d: print('NO') exit() print('YES')