Advertisement
Guest User

Untitled

a guest
May 27th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import java.util.*;
  2.  
  3.  
  4. public class scorify {
  5. public static void main(String[] args){
  6. Scanner in=new Scanner(System.in);
  7. int N=Integer.valueOf(in.next());
  8. for(int i=0;i<N;i++){
  9. int p=Integer.valueOf(in.next());
  10. String[] s=new String[p];
  11. String[] t=new String[p];;
  12. for(int j=0;j<p;j++){
  13. s[j]= in.next();
  14. t[j]=in.next();
  15. }
  16. int pe=Integer.valueOf(in.next());
  17. String[] c=new String[pe];
  18. for(int k=0;k<pe;k++){
  19. c[k]=in.next();
  20. }
  21.  
  22. for(int j=0;j<p;j++){
  23. int comp=0;
  24. for(int k=0;k<pe;k++){
  25. String se="";
  26. se=c[k];
  27. se=se.substring(0,t[j].length());
  28. if(se.equals(t[j])) comp++;
  29.  
  30. }
  31. System.out.print("|"+s[j]+":"+comp);
  32. }
  33. System.out.println();
  34.  
  35. }
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement