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 _01.Lambada_Expressions
- {
- class LambdaExpressions
- {
- static void Main(string[] args)
- {
- var line = Console.ReadLine()
- .Split(new[] { ' ', '=', '>', '.' }, StringSplitOptions.RemoveEmptyEntries);
- Dictionary<string, Dictionary<List<string>, string>> registry =
- new Dictionary<string, Dictionary<List<string>, string>>();
- Dictionary<string, Dictionary<List<string>, string>> orderedRegistry =
- new Dictionary<string, Dictionary<List<string>, string>>();
- var selector = "";
- var selectorObject = new List<string>();
- var property = "";
- var danceCounter = 0;
- while (line[0] != "lambada")
- {
- if (line[0] == "dance")
- {
- danceCounter++;
- }
- else
- {
- selector = line[0];
- selectorObject.Add(line[1]);
- property = line[2];
- if (!registry.ContainsKey(selector))
- {
- registry.Add(selector, new Dictionary<List<string>, string>());
- }
- registry[selector][selectorObject] = property;
- }
- line = Console.ReadLine()
- .Split(new[] { ' ', '=', '>', '.' }, StringSplitOptions.RemoveEmptyEntries);
- }
- foreach (var item in registry.Values)
- {
- Console.WriteLine($"{item.Keys} => {String.Join(" ", item.Values)}" );
- }
- Console.WriteLine(danceCounter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement