Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace LetterRepetiton
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<char, int> letters = new Dictionary<char, int>();
- char[] inputChars = Console.ReadLine().ToArray();
- for (int i = 0; i < inputChars.Length; i++)
- {
- if (!letters.ContainsKey(inputChars[i]))
- {
- letters.Add(inputChars[i], 0);
- }
- letters[inputChars[i]]++;
- }
- foreach (var item in letters.Keys)
- {
- Console.WriteLine($"{item} -> {letters[item]}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement