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; foreach (char bottom in bottomWord) { if (top == bottom) { bl = true; break; } } if (!bl) { Console.WriteLine("NO"); break; } bottomWord = bottomWord.Remove(0, 1); } if (bl) { Console.WriteLine("YES"); } } }