Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- namespace Advanced
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- var clothes = new Dictionary<string, Dictionary<string, int>>();
- for (int i = 0; i < n; i++)
- {
- var input = Console.ReadLine().Split(" -> ");
- var color = input[0];
- var clothingItems = input[1].Split(",");
- if (!clothes.ContainsKey(color))
- {
- clothes[color] = new Dictionary<string, int>();
- }
- foreach (var item in clothingItems)
- {
- if (!clothes[color].ContainsKey(item))
- {
- clothes[color][item] = 0;
- }
- clothes[color][item]++;
- }
- }
- var desiredItem = Console.ReadLine().Split();
- foreach (var colour in clothes)
- {
- Console.WriteLine($"{colour.Key} clothes:");
- foreach (var item in colour.Value)
- {
- Console.Write($"* {item.Key} - {item.Value}");
- if (desiredItem[0] == colour.Key && desiredItem[1] == item.Key)
- {
- Console.Write(" (found!)");
- }
- Console.WriteLine();
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment