Find count of repeated letters

1 次查看(过去 30 天)
Sir,
How to find the no. of repeated sequence (letters) in the given sentence.
for example, a="I want THAAAAAT APPPPPLE ):):):";
The No. of repeated sequences are: 3
ie.,
1. THAAAAAT
2. APPPPPLE
3. ):):):
thanks

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-9-30
a='I want THAAAAAT APPPPPLE ):):):'
s=regexp(a,'\s+','split')
out=s(~cellfun(@(x) numel(unique(x))==numel(x),s))
  3 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2013-10-1
In totally, ll are not repeated letter?
Jothi
Jothi 2013-10-7
But one problem sir,
The input file is ,
a='I want THAAAAAT APPPPPLE ):):): totally unprepared'
In this input we get
out =
'THAAAAAT' 'APPPPPLE' '):):):' 'totally' 'unprepared'
But the required output is,
out =
'THAAAAAT' 'APPPPPLE' '):):):'
how to solve this problem.
thank you sir.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by