def lengthOfLongestSubstringKDistinct(self, s, k):
# write your code here
if s == None or len(s) < k:
print([])
hash = {}
ans = []
word_set = set()
j = 0
for i in range(len(s)):
if i > 0:
hash[s[i - 1]] -= 1
if hash[s[i - 1]] == 0:
del hash[s[i - 1]]
while (j < len(s) and j - i + 1 <= k):
if s[j] in hash:
hash[s[j]] += 1
else:
hash[s[j]] = 1
if j - i + 1 == k:
if len(hash) == k:
if s[i:(j+1)] not in word_set:
ans.append(s[i:(j+1)])
word_set.add(s[i:(j+1)])
j += 1
print(ans)