Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Demo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- LinkedHashSet<String> words = new LinkedHashSet<>();
- for (int count = 1; count <= n; count++) {
- String word = scanner.nextLine();
- words.add(word);
- }
- //words.forEach(System.out::println);
- for (String word : words) {
- System.out.println(word);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment