Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleTests
- {
- class ConsoleTests
- {
- static void Main()
- {
- string text = Console.ReadLine();
- char[] separators = new char[] {'.', ' ', ','};
- string[] words = text.ToLower().Split(separators,StringSplitOptions.RemoveEmptyEntries);
- Array.Sort(words);
- int count = 1;
- for (int i = 0; i < words.Length && i + 1 < words.Length; i++)
- {
- if (words[i] == words[i + 1])
- {
- count++;
- }
- else
- {
- Console.WriteLine("{0} --> {1}", words[i], count);
- count = 1;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment