public class BooksSet
1: //BooksSet.java
3: import java.util.Scanner;
4: import java.util.HashSet;
6: public class BooksSet
7: {
8: public static void main(String[] args)
9: {
10: Scanner scnr = new Scanner(System.in);
11: HashSet<String> books = new HashSet<String>();
12: String userInput;
14: userInput = scnr.nextLine();
15: while (userInput.compareTo("done") != 0)
16: {
17: if (books.add(userInput))
18: {
19: System.out.println("a");
20: }
21: else
22: {
23: System.out.println("n");
24: }
25: userInput = scnr.nextLine();
26: }
28: System.out.println("Size: " + books.size());
29: }
30: }