Practice: Word Frequency
Split text and count with a dictionary or LINQ.
Example
var text = "the cat and the hat and the bat";
var freq = text.Split(' ').GroupBy(w => w).OrderByDescending(g => g.Count()).ThenBy(g => g.Key);
foreach (var g in freq) Console.WriteLine($"{g.Key}: {g.Count()}");Exercise
Count a group.
g.()
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.