Unique Visitor Tracker
Problem Description
Unique Visitor Tracker
In this problem, you will create a program that adds multiple visitor IDs to a HashSet to automatically exclude duplicates and displays the unique visitor count to standard output.
Learning Objective: Understand how to exclude duplicates using Set from collection Framework
Overview
Create a program to record website visitor IDs and count unique visitors by removing duplicates. Visitor IDs are given as integers, and the same ID may be recorded multiple times. Use Set to automatically exclude duplicates and display the final unique visitor count.
Input Format
The first line contains the number of visitor IDs n.
The next n lines each contain a visitor ID (integer).
Output Format
Output the unique visitor count in the format "Unique visitors: X".
Constraints
- 1 ≤ n ≤ 1000
- Visitor IDs are integers from 1 to 10000
Key Points
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up