Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //var regexRoot = @"\b([a-zA-Z]+)\:?\b";
- //var regexFile = @"\b([a-zA-Z]+)\.([a-zA-z]+)\b";
- //var regexSize = @"\b(\d+)\b";
- //var regexExt = @"\b(\.[a-z]+)\b";
- //MatchCollection matches = new MatchCollection();
- //int n = int.Parse(Console.ReadLine());
- //var pathdetails = new List<string>();
- //var inputLine = "";
- //for (int i = 0; i < n; i++)
- //{
- // inputLine = Console.ReadLine();
- // var paths = new List<string>();
- // paths.Add(inputLine);
- // pathdetails = inputLine.Split(new [] {' ',',','.',';',':'}).ToList();
- //}
- ////Console.WriteLine(string.Format("[" + string.Join(",",pathdetails) +"]"));
- //var keyLine = Console.ReadLine();
- //var extkey = keyLine[0];
- //var pathKey = keyLine[2];
- ////if (pathdetails[0] == pathKey && pathdetails[pathdetails.Count - 2] == extkey)
- ////{
- ////}
- var rootMatches = new SortedDictionary<string, Dictionary<string,Dictionary<string,long>>>();
- var directories = new List<string>();
- var extensions = new List<string>();
- var n = int.Parse(Console.ReadLine());
- var extension = "";
- var root = "";
- var file = "";
- var size = 0L;
- for (int i = 0; i < n; i++)
- {
- var inputLine = Console.ReadLine();
- directories.Add(inputLine);
- var input = inputLine.Split(new [] {'\\',' ',',',';','.',':'},StringSplitOptions.RemoveEmptyEntries).ToList();
- root = input[0];
- file = input[input.Count - 3];
- extension = input[input.Count - 2];
- size = long.Parse(input[input.Count - 1]);
- //extensions.Add(extension);
- if (!rootMatches.ContainsKey(root))
- {
- //rootMatches[root] = new Dictionary<string,Dictionary<string,long>>();
- rootMatches.Add(root,new Dictionary<string,Dictionary<string,long>>());
- }
- }
- var keyLine = Console.ReadLine().Split();
- var rootKey = keyLine[2];
- var rootExt = keyLine[0];
- foreach (var roote in rootMatches)
- {
- if (rootMatches.ContainsKey(rootKey) && rootMatches.Values.Last().Last().Equals(rootExt))
- {
- if (directories.Contains(root) && directories.Contains(extension))
- {
- Console.WriteLine("{0}.{1} - {2} KB",file,extension,size);
- }
- }
- }
- foreach (var root1 in rootMatches)
- {
- if (rootMatches.ContainsKey(rootKey))
- {
- foreach (var file in rootMatches[root1].Select(k => k.Value))
- {
- foreach (var extension in rootMatches[root1[file]].Select(a => a.Value))
- {
- if (rootMatches[root1[file]].ContainsKey(rootExt))
- {
- Console.WriteLine(directories[root]);
- }
- }
- }
- }
- }
- //var rootMatch = Regex.Matches(rootKey,regexRoot);
Advertisement
Add Comment
Please, Sign In to add comment