https://leetcode.com/problems/substrings-of-size-three-with-distinct-characters/



Runtime: 84 ms, faster than 52.78% of TypeScript online submissions for Substrings of Size Three with Distinct Characters.

Memory Usage: 47.5 MB, less than 5.55% of TypeScript online submissions for Substrings of Size Three with Distinct Characters.



```typescript
function countGoodSubstrings(s: string): number {
    //8:05
    const checkIfDuplicate = (subString: string) => {
        const aSet = new Set(subString)
        if (aSet.size != subString.length) {
            return true
        } else {
            return false
        }
    }
    
    let counting = 0
    for (const [index1, value1] of s.split("").entries()) {
        if ((index1 + 3) <= (s.length)) {
            const subString = s.slice(index1, index1+3)
            if (!checkIfDuplicate(subString)) {
                console.log(subString)
                counting += 1
            }
        }
    }
    return counting
    //8:10
};
```
