Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace CountCharsInAString
- {
- class Program
- {
- public static void Main()
- {
- var charsCount = Console.ReadLine()
- .Replace(" ", "")
- .GroupBy(x => x)
- .ToDictionary(x => x.Key, x => x.Count());
- foreach (var chr in charsCount)
- {
- Console.WriteLine($"{chr.Key} -> {chr.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement