arpit728

Untitled

Jul 1st, 2016
122
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. class A implements Comparable<A>{
  5. String s1,s2;
  6. A(String s1,String s2){
  7. this.s1=s1;
  8. this.s2=s2;
  9. }
  10. public int compareTo(A q){
  11. if((this.s1.compareTo(q.s1)==0) && (this.s2.compareTo(q.s2))==0 )return 0;
  12. return 1;
  13. }
  14. }
  15.  
  16. public class Solution {
  17.  
  18. public static void main(String[] args)throws IOException {
  19. BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  20. String s[];
  21. int n;
  22. n=Integer.parseInt(br.readLine());
  23. TreeSet<A> tree=new TreeSet<A>();
  24. for(int i=0;i<n;i++){
  25.  
  26. s=br.readLine().split("\\s");
  27. tree.add(new A(s[0],s[1]));
  28. System.out.println(tree.size());
  29. }
  30.  
  31. }
  32. }
RAW Paste Data