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 MainClass
- {
- public static void Main()
- {
- int number = int.Parse(Console.ReadLine());
- var dictionary = new Dictionary<string, List<string>>();
- for (int i = 0; i <= number-1; i++)
- {
- string word = Console.ReadLine().ToLower();
- string synonyms = Console.ReadLine().ToLower();
- if (dictionary.ContainsKey(word) == false)
- {
- dictionary[word] = new List<string>();
- dictionary[word].Add(synonyms);
- }
- else
- {
- dictionary[word].Add(synonyms);
- }
- }
- foreach (var item in dictionary)
- {
- Console.WriteLine($"{item.Key} - {string.Join(", ",item.Value)}");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment