Dictionary<string, int> GetWordsFrequencyCount(string text)
return text.Split(' ', '\n').Where(x => x != string.Empty).GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
Dictionary<int, int> GetWordsLengthFrequencyCount(string text)
Dictionary<int, int> lengthDictionary = new Dictionary<int, int>();
string[] words = text.Split(' ', '\n');
foreach (string word in words)
foreach(string word1 in words)
if (word1.Length == word.Length)
if (!lengthDictionary.ContainsKey(word.Length))
lengthDictionary.Add(word.Length, count);