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