Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- using System.Linq;
- using System.Collections.Generic;
- namespace SoftUniExamResults
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, List<string>> map =
- new Dictionary<string, List<string>>();
- string[] one = Console.ReadLine().Split(" | ");
- for (int i = 0; i < one.Length; i++)
- {
- string[] splitted = one[i].Split(": ");
- string word = splitted[0];
- string definition = splitted[1];
- if (!map.ContainsKey(word))
- {
- map.Add(word, new List<string>());
- }
- map[word].Add(definition);
- }
- string[] two = Console.ReadLine().Split(" | ");
- for (int i = 0; i < two.Length; i++)
- {
- string word = two[i];
- if (map.ContainsKey(word))
- {
- foreach (var worD in map.OrderBy(x=>x.Key))
- {
- if (worD.Key == word)
- {
- Console.WriteLine(worD.Key);
- foreach (var definition in worD.Value.OrderByDescending(x=>x.Length))
- {
- Console.WriteLine($"-{definition}");
- }
- }
- }
- //break;
- }
- }
- string three = Console.ReadLine();
- if (three=="End")
- {
- return;
- }
- if (three=="List")
- {
- foreach (var word in map.OrderBy(x=>x.Key))
- {
- Console.Write(word.Key + " ");
- }
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement