Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace odd_occurances
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, int> words = new Dictionary<string, int>();
- string[] inputWords = Console.ReadLine().ToLower().Split(' ');
- for (int i = 0; i < inputWords.Length; i++)
- {
- if (!words.ContainsKey(inputWords[i]))
- {
- words.Add(inputWords[i], 0);
- }
- words[inputWords[i]]++;
- }
- List<string> result = new List<string>();
- foreach (KeyValuePair<string, int> item in words)
- {
- if (item.Value % 2 == 1)
- {
- result.Add(item.Key);
- }
- }
- Console.WriteLine(string.Join(", ", result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement