using System; using System.Collections.Generic; using System.Linq; public class Test { static void Main() { SortedDictionary text = new SortedDictionary(); char[] characters = Console.ReadLine() .ToArray(); foreach (var character in characters) { if (text.ContainsKey(character)) { text[character]++; } else { text.Add(character, 1); } } foreach (var character in text) { Console.WriteLine($"{character.Key} -> {character.Value}"); } } }