using System.Collections.Generic;
public static void Main()
var listOfWords = new List<string>{"gandalf", "legolas", "arwen", "bilbo", "frodo", "balron", "saruman", "cedric"};
var match = string.Empty;
word = new string(word.Where(c => Char.IsLetterOrDigit(c) || Char.IsWhiteSpace(c)).ToArray());
if (!string.IsNullOrEmpty(word)) {
match = listOfWords.FirstOrDefault(x => word.All(y => x.Contains(y) && x.Count(z => z == y) == word.Count(z => z == y)));
if (!string.IsNullOrEmpty(match)) {
Console.WriteLine($"Found match: {match} ");
Console.WriteLine($"No match found.");