using System; using System.Diagnostics; namespace yukicoder { class Program { static void Main(string[] args) { //文字入力 string A = Console.ReadLine(); string B = Console.ReadLine(); //strBの数と同じならばループが終わる int count = 0; for (int i = 0; i < A.Length; i++) { //文字列の一部分の取得 string strB = B.Substring(i, 1); count++; //同じ文字列の検索 int str = A.IndexOf(strB, 0); //なければ、ループが終わる NO if (str == -1) { Console.WriteLine("NO"); break; } else { //文字列の削除 A= A.Remove(str, 1); } //strB = strB.Remove(i, 1); //カウントが文字列と同じならばYES if (count==A.Length) { Console.WriteLine("YES"); break; } } } } }