https://leetcode.com/problems/count-common-words-with-one-occurrence/


Runtime: 117 ms, faster than 70.00% of TypeScript online submissions for Count Common Words With One Occurrence.

Memory Usage: 48.2 MB, less than 25.00% of TypeScript online submissions for Count Common Words With One Occurrence.


```typescript
function countWords(words1: string[], words2: string[]): number {
    //9:00
    const map1 = new Map();
    for (const word of words1) {
        if (map1.has(word)) {
            map1.set(word, map1.get(word) + 1)
        } else {
            map1.set(word, 1)
        }
    }
    
    const map2 = new Map();
    for (const word of words2) {
        if (map2.has(word)) {
            map2.set(word, map2.get(word) + 1)
        } else {
            map2.set(word, 1)
        }
    }
    
    let counting = 0
    for (let [key, value] of map1) {
        if (map2.has(key)) {
            if ((value == 1) && (map2.get(key) == 1)) {
                counting += 1
            }
        }
    }
    
    return counting
    //9:05
};
```
