- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJavaHashset.java
More file actions
Latest commit
24 lines (19 loc) · 608 Bytes
/
Copy pathJavaHashset.java
File metadata and controls
24 lines (19 loc) · 608 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
packageDataStructure;
importjava.util.*;
publicclassJavaHashset {
publicstaticvoidmain(String[] args) {
Scanners = newScanner(System.in);
intt = s.nextInt();
String[] pair_left = newString[t];
String[] pair_right = newString[t];
for (inti = 0; i < t; i++) {
pair_left[i] = s.next();
pair_right[i] = s.next();
}
HashSet<String> set = newHashSet<>();
for (inti = 0; i < t; i++) {
set.add(pair_left[i] + " " + pair_right[i]);
System.out.println(set.size());
}
}
}