How to find the no. of repeated sequence (letters) in the given sentence.
for example, a="I want THAAAAAT APPPPPLE ):):): totally unprepared";
The No. of repeated sequences are: 3
No products are associated with this question.
Try to understand the following and fine-tune it to your needs:
n = sum( diff([0, diff(a)==0]) == 1 )
In particular, evaluate
and see how your problem actually translates into counting clusters of the outcome of diff(a)==0.
Play games and win prizes!Learn more