ファーウェイの練習3文字列の中で最も長い数字の列を見つけます


#include <stdlib.h>
#include "oj.h"


/*   :               ,          
    :
   unsigned int Continumax(char** pOutputstr,  char* intputstr)
    :
   char* intputstr       
    :
   char** pOutputstr:         ,              0,        
   pOutputstr             malloc    ,        

   :
             

 */
unsigned int Continumax(char** pOutputstr,  char* intputstr)
{
	if(intputstr==0||*intputstr=='\0'){//      
		char* p=(char*)malloc(sizeof(char));
		*p='\0';
		*pOutputstr=p;
		return 0;
	}
	int a=0;//       
	int b=0;//       
	int sitea=0;//        
	int siteb=0;
	bool isD=false;//            
	int i=0;
	for(;i<1000;){//       '\0‘
		if(*intputstr>='0'&&*intputstr<='9'){
			if(!isD)sitea=i;
			a++;
			isD=true;
		}else{
			if(isD){
				if(a>=b){
					siteb=sitea;
					b=a;
				}
				a=0;
				isD=false;
			}
		}
		if(*intputstr=='\0')break;
		i++;//       ,        
		intputstr++;
	}
	intputstr-=(i-siteb);	
	char* p=(char*)malloc(sizeof(char)*++b);
	for(int j=1;j<b;j++){
		*p++=*intputstr++;
	}
	*p='\0';
	p-=--b;
	*pOutputstr=p;
	return b;
}