Advertisement
Spocoman

02. Odd Occurrences

Apr 8th, 2023
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace OddOccurrences
  6. {
  7.     class Program
  8.     {
  9.         public static void Main()
  10.         {
  11.             var oddCounts = Console.ReadLine()
  12.                 .ToLower()
  13.                 .Split(" ")
  14.                 .GroupBy(x => x)
  15.                 .ToDictionary(x => x.Key, x => x.Count())
  16.                 .Where(x => x.Value % 2 == 1)
  17.                 .Select(x => x.Key)
  18.                 .ToList();
  19.  
  20.             Console.WriteLine(string.Join(" ", oddCounts));
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement