using System; class Program { static void Main(string[] args) { var a = Console.ReadLine(); var b = Console.ReadLine(); if (Check(a, b)) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } static bool Check(string a, string b) { var aArrays = a.ToCharArray(); var bArrays = b.ToCharArray(); Array.Sort(aArrays); Array.Sort(bArrays); if (new string(aArrays) == new string(bArrays)) return true; return false; } }