Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace Exercise
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- input = input.ToLower();
- var counts = new Dictionary<string, int>();
- for (int i = 0; i < input.Length; i++)
- {
- char current = input[i];
- if (current!=' ')
- {
- string forAdding = current.ToString();
- if (counts.ContainsKey(forAdding))
- { counts[forAdding]++; }
- else
- {
- counts.Add(forAdding, 1);
- }
- }
- }
- foreach (var item in counts)
- {
- Console.WriteLine(item.Key+ " -> "+ item.Value);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement