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 RE_Anon_Cache
- {
- class Program
- {
- static void Main(string[] args)
- {
- //List and dict
- var _ListOfSets = new List<string>();
- var _DictOFData = new Dictionary<string, Dictionary<string, long>>();
- string input = Console.ReadLine();
- while (input != "thetinggoesskrra")
- {
- if (input.Contains(" -> "))
- {
- string[] commands = input.Split(" ->|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToArray();
- string Data_Key = commands[0];
- long Data_Size = long.Parse(commands[1]);
- string Data_Set = commands[2];
- if (!_DictOFData.ContainsKey(Data_Set))
- {
- _DictOFData[Data_Set] = new Dictionary<string, long>();
- }
- _DictOFData[Data_Set][Data_Key] = Data_Size;
- }
- else
- {
- _ListOfSets.Add(input);
- }
- input = Console.ReadLine();
- }
- //Output
- foreach (var item in _ListOfSets)
- {
- if (!_DictOFData.ContainsKey(item))
- {
- _DictOFData.Remove(item);
- }
- }
- if (_DictOFData.Count > 0)
- {
- var result = _DictOFData.OrderByDescending(x => x.Value.Sum(e => e.Value)).First();
- Console.WriteLine($"Data Set: {result.Key}, Total Size: {result.Value.Sum(x => x.Value)}");
- foreach (var item in result.Value)
- {
- Console.WriteLine($"$.{item.Key}");
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment