using System.Collections.Generic;
static void Main(string[] args)
Console.WriteLine("Enter text:");
string text = Console.ReadLine().ToLower();
Console.WriteLine("Entered text: " + text);
Dictionary<string, int> WordDictionary;
WordDictionary = GetWordsFrequencyCount(text);
Dictionary<int, int> WordsLengthDictionary;
WordsLengthDictionary = GetWordsLengthFrequencyCount(text);
foreach (KeyValuePair<string, int> kvp in WordDictionary)
Console.Write(" {0}:{1}",
foreach (KeyValuePair<int, int> kvp in WordsLengthDictionary)
Console.Write(" {0}:{1}",
static Dictionary<string, int> GetWordsFrequencyCount(string text)
string[] words = text.Split(' ');
Dictionary<string, int> dictionary = new Dictionary<string, int>();
foreach(var word in words)
if (dictionary.Count == 0)
if(dictionary.ContainsKey(word) )
static Dictionary<int, int> GetWordsLengthFrequencyCount(string text)
string[] words = text.Split(' ');
Dictionary<int, int> dictionary = new Dictionary<int, int>();
foreach (var word in words)
int length = word.Length;
if (dictionary.Count == 0)
dictionary.Add(length, 1);
if (dictionary.ContainsKey(length))
dictionary.Add(length, 1);