# Read first line a = gets.to_s.strip # Read second line b = gets.to_s.strip a = a.chars.sort.join b = b.chars.sort.join puts (a == b ? "YES" : "NO")