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