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 GerryTutor
- {
- class Program
- {
- static List<double> Union(List<double> a, List<double> b)
- {
- List<double> result = new List<double>();
- foreach (var item in a)
- {
- if (!result.Contains(item))
- {
- result.Add(item);
- }
- }
- foreach (var item in b)
- {
- if (!result.Contains(item))
- {
- result.Add(item);
- }
- }
- return result;
- }
- static List<int> NonRepeat(int[] arr)
- {
- HashSet<int> set = new HashSet<int>();
- foreach (var item in arr)
- {
- set.Add(item);
- }
- return set.ToList();
- }
- static void Main(string[] args)
- {
- Dictionary<char, int> d = new Dictionary<char, int>();
- string text = Console.ReadLine();
- foreach (var ch in text)
- {
- if (!d.ContainsKey(ch))
- {
- d.Add(ch, 1);
- }
- else
- {
- d[ch]++;
- }
- }
- foreach (var item in d)
- {
- Console.WriteLine($"{item.Key} -> {item.Value}");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment