You are viewing a single comment's thread. Return to all comments →
Scanner scanner = new Scanner(System.in); Set<String> set = new HashSet<>(); int count = Integer.parseInt(scanner.nextLine()); for(int i = 0; i < count; i++) { String line = scanner.nextLine(); set.add(line); System.out.println(set.size()); }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Hashset
You are viewing a single comment's thread. Return to all comments →