Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class E04ParkingLot {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- List<String> list = new ArrayList<>();
- String[] input = sc.nextLine().split(", ");
- while (!input[0].equals("END")) {
- if (input[0].equals("IN")) {
- list.add(input[1]);
- } else {
- list.remove(input[1]);
- }
- input = sc.nextLine().split(", ");
- }
- if (list.isEmpty()) {
- System.out.println("Parking Lot is Empty");
- } else {
- list.forEach(System.out::println);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement