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