Least Substring
Last updated
Last updated
Explaination:
we can get "aa", "bbb", "c" three substring. # def getAns(self, s, k):
# # Write your code here
# cnt = 1
# res = 1
# sLen = len(s)
# cur = s[0]
# for i in range(1,sLen):
# if cnt == k or s[i] != s[i-1]:
# res += 1
# cnt = 0
# cnt += 1
# return res