class Program { static void Main(string[] args) { string topWord = Console.ReadLine()!; string bottomWord = Console.ReadLine()!; bool bl = false; foreach (char top in topWord) { bl = false; int count = 0; foreach (char bottom in bottomWord) { count++; if (top == bottom) { bl = true; break; } } if (!bl) { Console.WriteLine("NO"); break; } bottomWord = bottomWord.Remove(count - 1, 1); } if (bl) { Console.WriteLine("YES"); } } }