Advertisement
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 clothes2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, Dictionary<string, int>> clothes = new Dictionary<string, Dictionary<string, int>>();
- int numberOfEntries = int.Parse(Console.ReadLine());
- for (int br = 0; br < numberOfEntries; br++)
- {
- string[] intro = Console.ReadLine().Split(' ');
- string color = intro[0];
- string[] clothesSameColour = intro[2].Split(',').ToArray();
- if (!clothes.ContainsKey(color))
- {
- clothes.Add(color, new Dictionary<string, int>());
- }
- foreach (var cloth in clothesSameColour)
- {
- Dictionary<string, int> clothDB = clothes[color];
- if (!clothDB.ContainsKey(cloth))
- clothDB.Add(cloth,0);
- clothDB[cloth]++;
- }
- }
- string[] tosearchfor = Console.ReadLine().Split(' ');
- foreach (KeyValuePair<string,Dictionary<string,int>> item in clothes)
- {
- string color = item.Key;
- Dictionary<string, int> dataClothes = item.Value;
- Console.WriteLine("{0} clothes:", color);
- foreach (KeyValuePair<string,int> item2 in dataClothes)
- {
- string cloth = item2.Key;
- int times = item2.Value;
- Console.Write("* {0} - {1} ", cloth, times);
- if (color == tosearchfor[0] && tosearchfor[1] == cloth)
- Console.Write("(found!)");
- Console.WriteLine();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement