//写个算法“e5a3f2d1”,解压后为"eeeeeaaaffd"
//默认个数为1到9
//“e5a3f2d1”,解压后为"eeeeeaaaffd"
void func(char *str)
{
if (NULL == str)
{
return;
}
char *p = str;
char *pChar = p;
char a[100] = {'\0'};
int iFlag = 0; //数组下标
while((*p) != '\0')
{
//printf("%c\n",*p);
if ( (*p)>'0' && (*p)<= '9')
{
int n = (*p) - '0';
//printf("%c循环%d\n",*pChar,n);
while (n--)
{
a[iFlag] = *pChar;
iFlag++;
//printf("if iFlag = %d\n",iFlag);
}
//printf("%s\n",a);
}
else
{
pChar = p;
//printf("else iFlag = %d\n",iFlag);
}
p++;
}
printf("%s\n",a);
}