using System; using System.Collections.Generic; namespace _2._1.Count_Chars_in_a_String { class Program { static void Main() { string word = Console.ReadLine(); Dictionary histogram = new Dictionary(); foreach (var currentChar in word) { if (currentChar != ' ') { if (!histogram.ContainsKey(currentChar)) { // histogram.Add(currentChar, 0); histogram[currentChar] = 0; } histogram[currentChar]++; } } foreach (var item in histogram) { Console.WriteLine($"{item.Key} -> {item.Value}"); } } } }