Guest User

Untitled

a guest
Mar 18th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. class Main {
  4. public static void main(String[] args) {
  5. Scanner in = new Scanner(System.in);
  6. int t = in.nextInt();
  7. for (int x = 1; x <= t; ++x) {
  8. int n = in.nextInt();
  9. int m = in.nextInt();
  10. LinkedList<String> ll = new LinkedList<String>();
  11. for (int a = 0; a < n; ++a) {
  12. String s = in.next();
  13. ll.add(s);
  14. }
  15. int y = 0;
  16. for (int a = 0; a < m; ++a) {
  17. String s = in.next();
  18. String[] sa = s.split("/");
  19. String ns = "";
  20. for (int b = 1; b < sa.length; ++b) {
  21. ns += "/" + sa[b];
  22. if (!ll.contains(ns)) {
  23. ll.add(ns);
  24. ++y;
  25. }
  26. }
  27. }
  28. System.out.println("Case #" + x + ": " + y);
  29. }
  30. in.close();
  31. }
  32. }
Add Comment
Please, Sign In to add comment