using System.Collections.Generic;
namespace CodingChallenge
private string inputText;
public WordParser(string input)
public string ReturnUniqueWordsDelimited(Dictionary<string, string> words, string delimiter)
return string.Join(delimiter, words.Keys.Distinct());
public List<string> ReturnWordsWithDuplicatesList(Dictionary<string, string> words)
return words.Keys.GroupBy(word => word)
.Where(group => group.Count() > 1)
.Select(group => group.Key)
public DuplicatesDTO[] ReturnDuplicatesDTO(Dictionary<string, string> words)
return words.Keys.GroupBy(word => word)
.Select(group => new DuplicatesDTO
public class DuplicatesDTO
public string Word { get; set; }
public int? Count { get; set; }
public static void Main()
Console.WriteLine("Welcome to the Word Parser Coding Challenge");
var wordParser = new WordParser();
var distinctWordsDelimitedString = wordParser.ReturnUniqueWordsDelimited(words, delimiter: ",");
Console.WriteLine("ReturnUniqueWordsDelimited returned a count of " + distinctWordsDelimitedString.Split(',').Length);
var duplicateWordsList = wordParser.ReturnWordsWithDuplicatesList(words);
Console.WriteLine("ReturnWordsWithDuplicatesList returned a count of " + duplicateWordsList.Count);
var duplicatesDTOArray = wordParser.ReturnDuplicatesDTO(words);
Console.WriteLine("ReturnDuplicatesDTO returned a count of " + duplicatesDTOArray.Length);
Console.WriteLine("This concludes the Word Parser Coding Challenge!");
Console.WriteLine("Thank you for participating!");
public static Dictionary<string, string> GetWords()
return new Dictionary<string, string>
{"policeman", "bad_data"},
{"calculation", "bad_data"},
{"reflection", "bad_data"},
{"penetrate", "bad_data"},
{"conference", "bad_data"},