#include <iostream>
#include <string.h>
using namespace std;
int CountLongest(char*);
int main()
{
char szGame[] = "wwklllmmmm";
cout<<CountLongest(szGame)<<endl;
return 0;
}
int CountLongest(char* pBuf)
{
int result = 0;
char *p = pBuf;
if(*p=='\0')
return result;
while((*p)!='\0'&&(*p)==(*pBuf))
{
result++;
p++;
}
return result>CountLongest(p)?result:CountLongest(p);
}
用递归实现查找字符串中相同字符连续出现次数的最大值
最新推荐文章于 2023-07-03 22:05:33 发布