Count the k substring without changing the order
Problem to find the k length substring in the given string.
Example-1:
Input : s = "abcde" k = 2 Output : 4 Explain : The substrings are "ab","bc","cd","de".
Example-2:
Input : s = "abcdefg" k = 3 Output : 5 Explain : The substrings are "abc","bcd","cde","def","efg".
Solution
s = "abcde" k = 2 a = len(s)-(k-1) print(a)
Output
4