using System.Collections.Generic;
public static void Main()
GetWordsFrequencyCount("My bike and My book");
GetWordsLengthFrequencyCount("My bike and my book");
static int NumberOfWords (string word, string[] text)
var answer = from c in text
static Dictionary<string,int> GetWordsFrequencyCount(string text)
var FixedText = text.Split(' ');
Dictionary<string, int> result = new Dictionary<string, int>();
foreach (var word in FixedText)
if (!result.ContainsKey(word.ToLower()))
result.Add(word.ToLower(), NumberOfWords(word, FixedText));
static int NumberOfWordsWithSameLength (int length, string[] text)
var answer = from c in text
static Dictionary<int, int> GetWordsLengthFrequencyCount(string text)
var FixedText = text.Split(' ');
Dictionary<int, int> result = new Dictionary<int, int>();
foreach (var length in FixedText)
if (!result.ContainsKey(length.Length))
result.Add(length.Length, NumberOfWordsWithSameLength(length.Length, FixedText));