{}
CODE VISUALIZER
Master DSA, Python and C with step-by-step code visualization.
See it in action
CODE VISUALIZER
Master DSA, Python and C with step-by-step code visualization.
See it in action
run-icon
Main.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace ConsoleApp1 { internal class Program { static void Main(string[] args) { Dictionary<string, int> letterDictionary = new Dictionary<string, int>(); string text; string textLow; string textFormat; int count = 0; Console.WriteLine("Enter text: "); text = Console.ReadLine(); textLow = text.ToLower(); textFormat = textLow.Replace(" ", "").Replace(",", "").Replace("!", ""); for (int i = 0; i < textFormat.Length; i++) { if (textFormat[0] == textFormat[i]) { count++; } } letterDictionary.Add(textFormat, count); foreach (var pair in letterDictionary) { Console.WriteLine($"Letter: {pair.Key}, repetitions: {pair.Value}"); } } } }
Output