Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- string[] text = Console.ReadLine().Split(' ');
- Dictionary<string, int> st = new Dictionary<string, int>();
- foreach(string word in text)
- {
- if(st.ContainsKey(word))
- {
- st[word]++;
- }
- else
- {
- st[word] = 1;
- }
- }
- foreach(var el in st)
- {
- Console.WriteLine("{0} -> {1}", el.Key, el.Value);
- }
- }
- }
Add Comment
Please, Sign In to add comment