Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Advanced
- {
- class Program
- {
- static void Main(string[] args)
- {
- var shops = new SortedDictionary<string, Dictionary<string, double>>();
- while (true)
- {
- var input = Console.ReadLine();
- if (input == "Revision")
- {
- break;
- }
- var details = input.Split(", ");
- var shop = details[0];
- var product = details[1];
- var price = double.Parse(details[2]);
- if (!shops.ContainsKey(shop))
- {
- shops[shop] = new Dictionary<string, double>();
- }
- shops[shop][product] = price;
- }
- foreach (var shop in shops)
- {
- var shopName = shop.Key;
- var products = shop.Value;
- Console.WriteLine($"{shopName}->");
- foreach (var product in products)
- {
- Console.WriteLine($"Product: {product.Key}, Price: {product.Value}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement