Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace OddOccurrences
- {
- class MainClass
- {
- public static void Main()
- {
- List<string> listOfWords = Console.ReadLine().Split().ToList();
- Dictionary<string, int> dictionary = new Dictionary<string, int>();
- for (int i = 0; i <= listOfWords.Count-1; i++)
- {
- string word = listOfWords[i].ToLower();
- if (dictionary.ContainsKey(word) == false)
- {
- dictionary[word] = 1;
- }
- else
- {
- dictionary[word]++;
- }
- }
- var filteredDict = dictionary.Where(x => x.Value % 2 != 0).ToDictionary(x => x.Key, x => x.Value);
- Console.WriteLine(string.Join(" ",filteredDict.Keys));
- }
- }
- }
Add Comment
Please, Sign In to add comment