Advertisement
Lazov

temp

Jan 26th, 2019
98
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. namespace _05._Count_Symbols
  5. {
  6. class CountSymbols
  7. {
  8. static void Main(string[] args)
  9. {
  10. var input = Console.ReadLine();
  11.  
  12. var text = new SortedDictionary<char, int>();
  13.  
  14. for (int i = 0; i < input.Length; i++)
  15. {
  16. var textChar = input[i];
  17.  
  18. if (!text.ContainsKey(textChar))
  19. {
  20. text[textChar] = 1;
  21. }
  22. else
  23. {
  24. text[textChar]++;
  25. }
  26.  
  27. }
  28.  
  29. foreach (var item in text)
  30. {
  31. Console.WriteLine($"{item.Key}: {item.Value} time/s");
  32. }
  33.  
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement