Ok, so I started with this:
string str = Console.ReadLine();
string[] strSeparator = new string[] { " " };
But I don't know how to count the occurances. My question is, which is the easiest method? I found something like this:
var result = str.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)
.GroupBy(r => r)
.Select(grp => new
{
Word = grp.Key,
Count = grp.Count()
});
But I don't understand who is 'r' or 'grp' and how I declare them. It'll be helpful some advice and examples.