deyanmalinov

02. SoftUni Party

May 27th, 2019
143
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2. import java.util.TreeSet;
  3.  
  4. public class Main {
  5.     public static void main(String[] args) {
  6.         Scanner scan = new Scanner(System.in);
  7.         TreeSet<String> guest = new TreeSet<>();
  8.         String line;
  9.         while (!"PARTY".equals(line = scan.nextLine())){
  10.             guest.add(line);
  11.         }
  12.         while (!"END".equals(line = scan.nextLine())){
  13.             guest.remove(line);
  14.         }
  15.         System.out.println(guest.size());
  16.         for (String s : guest) {
  17.             System.out.println(s);
  18.         }
  19.     }
  20. }
RAW Paste Data