Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Letter_Repetition
- {
- class Program
- {
- static void Main(string[] args)
- {
- char[] input = Console.ReadLine().ToCharArray();
- Dictionary<char, int> count = new Dictionary<char, int>();
- foreach (var x in input)
- {
- if (!count.ContainsKey(x))
- {
- count[x] = 0;
- }
- count[x]++;
- }
- foreach (var c in count)
- {
- Console.WriteLine($"{c.Key} -> {c.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement