Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Linq;
- using System.Numerics;
- using System.Text.RegularExpressions;
- namespace DebbugingSpace
- {
- class Program
- {
- static void Main(string[] args)
- {
- BigInteger count = BigInteger.Parse(Console.ReadLine());
- Dictionary<string, Dictionary<string, string>> files =
- new Dictionary<string, Dictionary<string, string>>();
- string fileName = "";
- for (int i = 0; i < count; i++)
- {
- var input = Console.ReadLine();
- var inputActual = input.Split(new char[] {'\\', ';', ' '}, StringSplitOptions.RemoveEmptyEntries)
- .ToArray();
- string homeDirectory = inputActual[0];
- string size = inputActual.Last();
- string pattern = @"\b\w+.\w+\b";
- foreach (Match m in Regex.Matches(input, pattern))
- {
- fileName = m.Value;
- }
- if (!files.ContainsKey(homeDirectory))
- {
- files.Add(homeDirectory,new Dictionary<string, string>());
- }
- else
- {
- if (!files[homeDirectory].ContainsKey(fileName))
- {
- files[homeDirectory].Add(fileName, size);
- }
- else
- {
- files[homeDirectory][fileName] = size;
- }
- }
- }
- var lastInput = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries)
- .ToArray();
- string fileExtension = lastInput.First();
- string rootResult = lastInput.Last();
- foreach (var item in files)
- {
- if (item.Equals(rootResult) && item.Value.ContainsKey(fileExtension))
- {
- Console.WriteLine("Yes");
- }
- else
- {
- Console.WriteLine("No");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement