Given a string of lowercase alphabets, count all possible substrings (not necessarily distinct) that have exactly k distinct characters.
The first line of input contains a single integer T denoting the number of test cases. ThenT test cases follow. Each test case consist of two lines. The first line of each test case consists of a string S.
The second line of each test case contains integer K.
Corresponding to each test case, in a new line, print the count all possible substrings that has exactly k distinct characters.