Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace RemoveOddOccurrences
  5. {
  6. public class RemoveOddOccurrences
  7. {
  8. public static void Main()
  9. {
  10. var input = Console.ReadLine().Split(new[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries)
  11. .Select(int.Parse).ToList();
  12. int[] count = new int[10];
  13.  
  14. for (int x = 0; x < 10; x++)
  15. {
  16. for (int y = 0; y < input.Count; y++)
  17. {
  18. if (input[y] == x)
  19. count[x]++;
  20. }
  21. }
  22. for (int i = 0; i < count.Length; i++)
  23. {
  24. if (count[i]%2==1)
  25. {
  26. input.RemoveAll(x => x == i);
  27.  
  28. }
  29. }
  30. Console.WriteLine(string.Join(" ",input));
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement