// You are given a string s consisting of lowercase characters and an integer k, You have to count all possible substrings that have exactly k distinct characters.
int res = contiguousStrings(str, i + 1, j, n - 1) + contiguousStrings(str, i, j - 1, n - 1) - contiguousStrings(str, i + 1, j - 1, n - 2); ...