I want to find all the counts (overlapping and non-overlapping) of a sub-string in a string. I found two answers one of which is using regex which is not my intention and the other was much more in-efficient than I need. I need something like:
'ababaa'.count('aba') == 2
str.count() just counts simple substrings. What should I do?