using System.Collections.Generic;
public static void Main()
public static Dictionary<string, int> GetWordsFrequencyCount(string text)
Dictionary<string, int> wordsFrequency = new Dictionary<string, int>();
string[] words = text.Split(' ');
for (int i = 0; i < words.Length; i++)
string lowered = words[i].ToLower();
if (wordsFrequency.ContainsKey(lowered))
wordsFrequency.TryGetValue(lowered, out count);
wordsFrequency.Remove(lowered);
wordsFrequency.Add(lowered, count + 1);
wordsFrequency.Add(lowered, 1);
public static Dictionary<int, int> GetWordsLengthFrequencyCount(string text)
Dictionary<int, int> lengthFrequency = new Dictionary<int, int>();
string[] words = text.Split(' ');
for (int i = 0; i < words.Length; i++)
if (lengthFrequency.ContainsKey(words[i].Length))
lengthFrequency.TryGetValue(words[i].Length, out count);
lengthFrequency.Remove(words[i].Length);
lengthFrequency.Add(words[i].Length, count + 1);
lengthFrequency.Add(words[i].Length, 1);