I want to count a long string contain how many substring, how to do it in python?
"12212"
contains 2x "12"
how to get the count number?
It must allow for overlaping substrings; for instance "1111" contains 3 "11"
substrings.
"12121"
contains 2 "121"
substrings.
"1111".count("11")
will return 2. It does not count any overlaps.