Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- class A implements Comparable<A>{
- String s1,s2;
- A(String s1,String s2){
- this.s1=s1;
- this.s2=s2;
- }
- public int compareTo(A q){
- if((this.s1.compareTo(q.s1)==0) && (this.s2.compareTo(q.s2))==0 )return 0;
- return 1;
- }
- }
- public class Solution {
- public static void main(String[] args)throws IOException {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
- String s[];
- int n;
- n=Integer.parseInt(br.readLine());
- TreeSet<A> tree=new TreeSet<A>();
- for(int i=0;i<n;i++){
- s=br.readLine().split("\\s");
- tree.add(new A(s[0],s[1]));
- System.out.println(tree.size());
- }
- }
- }
Add Comment
Please, Sign In to add comment