Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char[] separators = new char[] { ' ', ';' };
- string[] sentence = Console.ReadLine().Split(separators, StringSplitOptions.RemoveEmptyEntries);
- var query = (from i in sentence
- group i by i into g
- orderby g.Count() descending
- select new { Key = g.Key, Count = g.Count() }).FirstOrDefault();
- if (query == null)
- {
- Console.WriteLine("query = NULL");
- }
- else
- {
- Console.WriteLine("{0}", query.Key);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement