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 input = scanner.nextLine();
- TreeSet<String> vip = new TreeSet<>();
- TreeSet<String> regular = new TreeSet<>();
- while (!input.equals("PARTY")) {
- for (int i = 0; i < input.length(); i++) {
- char firstChar = input.charAt(0);
- if (Character.isDigit(firstChar)) {
- vip.add(input);
- } else {
- regular.add(input);
- }
- break;
- }
- input = scanner.nextLine();
- }
- while (!input.equals("END")) {
- input = scanner.nextLine();
- vip.remove(input);
- regular.remove(input);
- }
- int count = vip.size() + regular.size();
- System.out.println(count);
- for (String guestVip : vip) {
- System.out.println(guestVip);
- }
- for (String guestRegular : regular) {
- System.out.println(guestRegular);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement