I have a string that holds a very long word, only one word without whitespaces/spaces.
mystring = "abcdthisisatextwithsampletextforasampleabcd"
I would like to find all of the repeated character combinations that contains minimum 4 chars.
So I would like to achieve something like this:
'text' 2 times
'sample' 2 times
'abcd' 2 times
As both abcd
,text
and sample
can be found two times in the mystring
they were recognized as propely matched chars combinations with more than 4 char length. It's important that I am seeking repeated char combinations, finding only existing english words is not a requirement.
The answers I found are helpful for finding duplicates in texts with whitespaces, but I couldn't find a proper resource that covers the situation when there are no spaces and whitespaces in the string. I would really appreciate if somebody could show me how this should be done the most efficient way.
from Finding repeated character combinations in string
No comments:
Post a Comment