, , , - , , , , , , , - .
, :
MatchString.ToList().ForEach(Item => Input.Remove(Item));
:
public bool IsSubSetOf(string InputString, string MatchString)
{
var InputChars = InputString.ToList();
MatchString.ToList().ForEach(Item => InputChars.Remove(Item));
return InputChars.Count == 0;
}
, , .
, "got" , , "gott" , "t" . , . , "gott" - "catdog", "got".
:
using System;
using System.Linq;
using System.Runtime.CompilerServices;
static class extensions
{
public static bool IsSubSetOf(this string InputString, string MatchString)
{
var InputChars = InputString.ToList();
MatchString.ToList().ForEach(Item => InputChars.Remove(Item));
return InputChars.Count == 0;
}
}
, thins , :
Console.WriteLine("gott".IsSubSetOf("catdog"));