#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); }