Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
536 B
0
Indexable
Never
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class _01_UniqueUsernames {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        Set<String> usernames = new LinkedHashSet<>();

        int n = Integer.parseInt(scanner.nextLine());
        for (int i = 0; i < n; i++) {
            String username = scanner.nextLine();
            usernames.add(username);
        }

        usernames.forEach(username -> System.out.println(username));
    }
}
Leave a Comment