Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _5._2.KeyKeyValueValue
- {
- class Program
- {
- static void Main(string[] args)
- {
- string searchedKey = Console.ReadLine();
- string searchedValue = Console.ReadLine();
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string[] tokens = Console.ReadLine().Split(new string[] { " => " }, StringSplitOptions.RemoveEmptyEntries);
- string mainWord = tokens[0];
- string[] minorWords = tokens[1].Split(';');
- if (mainWord.Contains(searchedKey))
- {
- Console.WriteLine($"{mainWord}:");
- foreach (var minorWord in minorWords)
- {
- if (minorWord.Contains(searchedValue))
- {
- Console.WriteLine($"-{minorWord}");
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment