020-002-001

Set Management: Unique Visitors

Easy

Problem Description

In this problem, you will create a program that manages visitor names using a HashSet, automatically eliminates duplicates, and displays the unique visitor count and visitor list to standard output.

Learning Objective: Use HashSet to automatically eliminate duplicates and manage only unique data

Create a program to record website visitor names and count unique visitors. A HashSet is a "collection that does not allow duplicates" — even if the same value is added multiple times, it retains only one copy. Leverage this characteristic to automatically eliminate duplicates.

Input

Line 1: Number of access records (integer, 1-20 times)
Lines 2~N+1: Visitor name (string)

Output

Visitor Analysis:
Total Access: [access count]
Unique Visitors: [unique visitor count]
Visitor List:
[visitor 1]
[visitor 2]
...
```java

Visitor list displayed in addition order.

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
5
Alice
Bob
Alice
Charlie
Bob
Expected Output:
Visitor Analysis:
Total Access: 5
Unique Visitors: 3
Visitor List:
Alice
Bob
Charlie
Normal case
Input:
4
David
Emily
Frank
George
Expected Output:
Visitor Analysis:
Total Access: 4
Unique Visitors: 4
Visitor List:
David
Emily
Frank
George

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 10 free executions remaining