private string questionMatch(string input)
{
input = input.ToLower();
questionLeft = questionLeft.ToLower();
//list that will hold the permutaitons of the string
List<customMatchObject> permutations = getPermutations(questionLeft);
input = input.Trim();
input = input.Insert(0, " ");
input = input.Insert(input.Length, " ");
//trimming the questionLeft
questionLeft = questionLeft.Trim();
questionLeft = questionLeft.Insert(0, " ");
questionLeft = questionLeft.Insert(questionLeft.Length, " ");
//looping through all permutations
foreach (var item in permutations)
{
//if a word is found, it's removed from all the questionLeft variable also with it's components
//ex: Mac book would remove Macbook, Mac, book from the questionleft
if ((input.Contains(" " + (item.word) + " ")))
{
questionLeft = questionLeft.Replace(" " + item.word + " ", " ");
foreach (var wd in item.wordsUsed)
{
if (questionLeft.Contains(" " + wd + " "))
questionLeft = questionLeft.Replace(" " + wd + " ", " ");
}
}
}
while (questionLeft.Contains(" "))
questionLeft = questionLeft.Replace(" ", " ");
questionLeft = questionLeft.Trim();
return questionLeft;
}