Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.TreeSet;
- public class Main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- TreeSet<String> guest = new TreeSet<>();
- String line;
- while (!"PARTY".equals(line = scan.nextLine())){
- guest.add(line);
- }
- while (!"END".equals(line = scan.nextLine())){
- guest.remove(line);
- }
- System.out.println(guest.size());
- for (String s : guest) {
- System.out.println(s);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment