Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace WordSynonyms
- {
- class Program
- {
- public static void Main()
- {
- Dictionary<string, List<string>> words = new Dictionary<string, List<string>>();
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string word = Console.ReadLine();
- string synonym = Console.ReadLine();
- if (!words.ContainsKey(word))
- {
- words.Add(word, new List<string>());
- }
- words[word].Add(synonym);
- }
- foreach (var word in words)
- {
- Console.Write($"{word.Key} - {string.Join(", ", word.Value)}\n");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement