Dictionary (Demo exam)
условие: https://judge.softuni.bg/Contests/Practice/DownloadResource/5507
Може ли малко помощ с решението на задачата. Вчера на демо изпита я докарах до 60/100.
using System;
using System.Collections.Generic;
using System.Linq;
class Tech_Module
{
    static void Main()
    {
        List<string> firstString = Console.ReadLine().Split(" | ").ToList();
        List<string> secondString = Console.ReadLine().Split(" | ").ToList();
        string thirdString = Console.ReadLine();
        Dictionary<string, string> wordAndDescription = new Dictionary<string, string>();
        firstString.Sort();
        for (int i = 0; i < firstString.Count; i++)
        {
            string[] currentLine = firstString[i].Split(": ").ToArray();
            string word = currentLine[0];
            string description = currentLine[1];
            if (!wordAndDescription.ContainsKey(word))
            {
                wordAndDescription.Add(word, description);
            }
            else
            {
                wordAndDescription[word] = description;
            }
        }
        if (thirdString == "List")
        {
            foreach (var kvp in wordAndDescription)
            {
                Console.Write($"{kvp.Key} ");
            }
        }
        else if (thirdString == "End")
        {
            foreach (var kvp in wordAndDescription)
            {
                if (wordAndDescription.ContainsKey(kvp.Key) && wordAndDescription.ContainsValue(kvp.Value))
                {
                    Console.WriteLine($"{kvp.Key}");
                    Console.WriteLine($" -{kvp.Value}");
                }               
            }
        }
    }
}
Мерси за обясненията! Не съм бил разбрал условието на задачата правилно.., и не съм решавал много задачи с речници.