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