You are viewing a single comment's thread. Return to all comments →
Just in case, here is version with boilerplate. Java8, copypaste, ..., profit!
import java.io.*; import java.util.*; import java.util.stream.*; public class Solution { // the code from above public static void main(String[] args) { Scanner in = new Scanner(System.in); List<String> strings = IntStream.range(0, in.nextInt()).mapToObj(i -> in.next()).collect(Collectors.toList()); IntStream.range(0, in.nextInt()).mapToObj(i -> in.next()).mapToLong(q -> strings.stream().filter(q::equals).count()).forEach(System.out::println); } // }
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 →
Just in case, here is version with boilerplate. Java8, copypaste, ..., profit!