Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace apps
- {
- class Program
- {
- static string Get() { return Console.ReadLine(); }
- static void Main()
- {
- string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- string input = Get();
- Dictionary<char, int> occurances = new Dictionary<char, int>();
- foreach (char c in input)
- {
- if (alphabet.Contains(c) == true && occurances.ContainsKey(c) == false)
- {
- occurances.Add(c, 0);
- }
- }
- foreach (char c in input)
- {
- if (c != ' ')
- {
- occurances[c]++;
- }
- }
- foreach( var v in occurances)
- {
- Console.WriteLine($"{v.Key} -> {v.Value}");
- }
- }// END MAIN
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement