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