Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.io.IOException;
- import java.time.LocalTime;
- import java.time.format.DateTimeFormatter;
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String line = scanner.nextLine();
- HashSet<String> parkingLot = new HashSet<>();
- while (!line.equals("END")) {
- String[] parts = line.split(", ");
- if (parts[0].equals("IN")) {
- parkingLot.add(parts[1]);
- } else {
- parkingLot.remove(parts[1]);
- }
- line = scanner.nextLine();
- }
- if (parkingLot.isEmpty()) {
- System.out.println("Parking Lot is Empty");
- } else {
- for (String carNumber : parkingLot) {
- System.out.println(carNumber);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement