Count Common Words With One Occurrence
Given two string arrays words1 and words2, return the number of strings that appear exactly once in each of the two arrays.
Example 1
Input
words1 = ["leetcode","is","amazing","as","is"], words2 = ["amazing","leetcode","is"]Output
2"leetcode" and "amazing" each appear exactly once in both arrays, while "is" appears twice in
words1 and "as" does not appear in words2.Example 2
Input
words1 = ["b","bb","bbb"], words2 = ["a","aa","aaa"]Output
0There are no strings that appear in each of the two arrays.
Constraints
- 1 <= words1.length, words2.length <= 1000
- 1 <= words1[i].length, words2[j].length <= 30
- words1[i] and words2[j] consists only of lowercase English letters.