Advertisement
Guest User

Untitled

a guest
Oct 6th, 2016
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. string[] words = Console.ReadLine().ToLower().Split(' ');
  9.  
  10. var counts = new Dictionary<string, int>();
  11.  
  12. foreach (var word in words)
  13. {
  14. if (counts.ContainsKey(word))
  15. {
  16. counts[word]++;
  17. }
  18. else
  19. {
  20. counts[word] = 1;
  21. }
  22. }
  23.  
  24. //var results = new List<string>();
  25.  
  26. foreach (var pair in counts)
  27. {
  28. if (pair.Value % 2 != 0)
  29. {
  30. Console.WriteLine("{0} -> {1}", pair.Keys, pair.Values);
  31. }
  32. }
  33. //Console.WriteLine(string.Join(", ", results));
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement