I recently came across the count function python. I got a question. It works fine for the below example:
Input: String: rrr
Substring: rr
Output: 1
So when I count the number of time the substring appear it works. But what I want to know is what if I want to count the repetition of substring. For example,
Input: String: rrr
Substring: rr
Output: 2
Here it considers the repeated character in the substring,
Given: rrr
Here r
is mid character hence
It pairs it as rr
and rr
. So the output is 2.
Hope you understand my doubt.
Thank you