Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _05._Count_Symbols
- {
- class CountSymbols
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine();
- var text = new SortedDictionary<char, int>();
- for (int i = 0; i < input.Length; i++)
- {
- var textChar = input[i];
- if (!text.ContainsKey(textChar))
- {
- text[textChar] = 1;
- }
- else
- {
- text[textChar]++;
- }
- }
- foreach (var item in text)
- {
- Console.WriteLine($"{item.Key}: {item.Value} time/s");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement