Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace SoftUniParking
- {
- class Program
- {
- public static void Main()
- {
- Dictionary<string, string> parkingUsers = new Dictionary<string, string>();
- int commandCount = int.Parse(Console.ReadLine());
- for (int i = 0; i < commandCount; i++)
- {
- string[] current = Console.ReadLine().Split(" ");
- string command = current[0];
- string user = current[1];
- if (command == "register")
- {
- if (!parkingUsers.ContainsKey(user))
- {
- string number = current[2];
- parkingUsers.Add(user, number);
- Console.WriteLine($"{user} registered {number} successfully");
- }
- else
- {
- Console.WriteLine($"ERROR: already registered with plate number {parkingUsers[user]}");
- }
- }
- else
- {
- if (parkingUsers.ContainsKey(user))
- {
- parkingUsers.Remove(user);
- Console.WriteLine($"{user} unregistered successfully");
- }
- else
- {
- Console.WriteLine($"ERROR: user {user} not found");
- }
- }
- }
- foreach (var user in parkingUsers)
- {
- Console.WriteLine($"{user.Key} => {user.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement