Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class OddOccurance
- {
- static void Main()
- {
- var words = Console.ReadLine().ToLower().Split(' ');
- var result = new List<string>();
- var allWords = new Dictionary<string, int>();
- foreach (var word in words)
- {
- if (!allWords.ContainsKey(word))
- {
- allWords.Add(word, 1);
- }
- else
- {
- allWords[word]++;
- }
- }
- foreach (var item in allWords)
- {
- if (item.Value % 2 == 1)
- {
- result.Add(item.Key);
- }
- }
- Console.WriteLine(string.Join(", ", result));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement