Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class CountSymbols
- {
- static void Main()
- {
- string input = Console.ReadLine();
- SortedDictionary<char, int> characters = new SortedDictionary<char, int>();
- foreach (char character in input)
- {
- if (characters.ContainsKey(character))
- {
- characters[character]++;
- }
- else
- {
- characters.Add(character, 1);
- }
- }
- char[] charKeys = characters.Keys.ToArray();
- foreach (var character in charKeys)
- {
- Console.WriteLine($"{character}: {characters[character]} time/s");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement