You are viewing a single comment's thread. Return to all comments →
ArrayList<String> a = new ArrayList<String>(); Scanner scan = new Scanner(System.in); int n = scan.nextInt(); for(int i = 0; i < n; i++) { a.add(scan.next()); } int q = scan.nextInt(); for(int i = 0; i < q; i++) { int count = 0; String s = scan.next(); for(String str : a) { if(str.equals(s)) count++; } System.out.println(count); }
LOL
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
LOL