I was doing this leetcode problem, and this was the solution in Java they gave for this problem:
class Solution {
public List<String> wordSubsets(String[] A, String[] B) {
int[] bmax = count("");
for (String b: B) {
int[] bCount = count(b);
for (int i = 0; i < 26; ++i)
bmax[i] = Math.max(bmax[i], bCount[i]);
}
List<String> ans = new ArrayList();
search: for (String a: A) {
int[] aCount = count(a);
for (int i = 0; i < 26; ++i)
if (aCount[i] < bmax[i])
continue search;
ans.add(a);
}
return ans;
}
public int[] count(String S) {
int[] ans = new int[26];
for (char c: S.toCharArray())
ans[c - 'a']++;
return ans;
}
}
In the second for loop after the "ans" List is instantiated, you can see that there is a term used called "search" followed by a colon. In addition, it is also used inside the second for loop which is contained by the first, with "continue" before it. Can someone explain this term to me and how it works?