SHARE
TWEET

Softuni Party - Set

IrinaIgnatova Oct 23rd, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3.  
  4. import java.io.IOException;
  5.  
  6.  
  7. import java.time.LocalTime;
  8. import java.time.format.DateTimeFormatter;
  9. import java.util.*;
  10.  
  11. public class Main {
  12.  
  13.  
  14.     public static void main(String[] args) {
  15.         Scanner scanner = new Scanner(System.in);
  16.  
  17.         String input = scanner.nextLine();
  18.  
  19.         TreeSet<String> vip = new TreeSet<>();
  20.         TreeSet<String> regular = new TreeSet<>();
  21.  
  22.  
  23.         while (!input.equals("PARTY")) {
  24.             for (int i = 0; i < input.length(); i++) {
  25.                 char firstChar = input.charAt(0);
  26.  
  27.                 if (Character.isDigit(firstChar)) {
  28.                     vip.add(input);
  29.                 } else {
  30.                     regular.add(input);
  31.                 }
  32.                 break;
  33.             }
  34.  
  35.             input = scanner.nextLine();
  36.  
  37.  
  38.         }
  39.         while (!input.equals("END")) {
  40.             input = scanner.nextLine();
  41.             vip.remove(input);
  42.             regular.remove(input);
  43.         }
  44.  
  45.  
  46.         int count = vip.size() + regular.size();
  47.         System.out.println(count);
  48.         for (String guestVip : vip) {
  49.             System.out.println(guestVip);
  50.         }
  51.         for (String guestRegular : regular) {
  52.             System.out.println(guestRegular);
  53.         }
  54.  
  55.  
  56.     }
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top