A string is good if there are no repeated characters. Given string s, return the number of good substrings of length exactly 3.

Input: "xyzzaz" → Output: 1 (only "xyz" is good)Input: "aababcabc" → Output: 4

Slide a window of fixed size 3, check if all 3 characters are distinct.

class Solution { public int countGoodSubstrings(String s) { int count = 0; for (int i = 0; i + 2 < s.length(); i++) { char a = s.charAt(i), b = s.charAt(i + 1), c = s.charAt(i + 2); if (a != b && b != c && a != c) count++; } return count; } }