[ACM]Q10340: All in All
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Q10340
{
class Program
{
static private string[] sarr; static private char[] par = { ' ' }; static private bool tof;
static void Main(string[] args)
{
for (; ; )
{
label: Console.Write("string>>>");
sarr = Console.ReadLine().Split(par, StringSplitOptions.RemoveEmptyEntries);
if (sarr.Length != 2) goto label;
tof = false;
if (sarr[0].Length > sarr[1].Length) Console.WriteLine("No");
else if (sarr[0].Length == sarr[1].Length)
Console.WriteLine(sarr[0] == sarr[1] ? "Yes" : "No");
else
{
for (int i = 0; i < sarr[0].Length; i++)
{
if (sarr[1].IndexOf(sarr[0].Substring(i, 1)) != -1)
{
sarr[1] = sarr[1].Substring(sarr[1].IndexOf(sarr[0].Substring(i, 1)) + 1);
tof = true;
}
else
{
tof = false; break;
}
}
Console.WriteLine(tof ? "Yes" : "No");
}
}
}
}
}