Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace userLogs
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- List<string> list = new List<string>(Console.ReadLine().Split(new[] { '=', ' ' }, StringSplitOptions.RemoveEmptyEntries));
- SortedDictionary<string, Dictionary<string, int>> dict = new SortedDictionary<string, Dictionary<string, int>>();
- while (list[0] != "end")
- {
- for (int i = 0; i < list.Count; i += 6)
- {
- if (!dict.ContainsKey(list[i + 5]))
- {
- dict[list[i + 5]] = new Dictionary<string, int>();
- }
- if (!dict[list[i + 5]].ContainsKey(list[i + 1]))
- {
- dict[list[i + 5]][list[i + 1]] = 1;
- }
- else
- {
- dict[list[i + 5]][list[i + 1]] += 1;
- }
- }
- list = new List<string>(Console.ReadLine().Split(new[] { '=', ' ' }, StringSplitOptions.RemoveEmptyEntries));
- }
- foreach (var item in dict)
- {
- Console.WriteLine($"{item.Key}:");
- foreach (var entry in item.Value)
- {
- Console.Write(string.Join(", ", $"{entry.Key} => {entry.Value}"));
- }
- Console.Write('.');
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement