/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 * 
 * @param param string字符串 
 * @return string字符串
 */
void Str(char* p1, char*p2)
{
    while(*p2 != '\0')
    {
        *p1 = *p2;
        p1++;
        p2++;
    }
    *p1 = '\0';
}

char* compressString(char* param ) {
    // write code here

    if (param == NULL)
    {
        return NULL;
    }
    int num = 0;
    char* p1 = param;
    char* p2 = param + 1;
    while(*p1 != '\0' && *p2 != '\0')
    {

        if (*p1 == *p2)
        {
            num = 2;
            while(*(p2+1) == *p1)
            {
                num = num + 1;
                p2++;

            }
            if (num / 10 != 0){
                int i = 0;
                while(num != 0)
                {
                    *(p2-i) = num % 10 + '0';
                    num /= 10;
                    i++;
                }
                p1++;
                Str(p1, p2 - i + 1);
                p1 += i;
                p2 = p1 + 1;
            }
            else
            {
                *p2 = num + '0';
                p1++;
                Str(p1, p2);
                p1++;
                p2 = p1 + 1;
            }
            
        }
        else 
        {
            printf("%c,%c", *p1, *p2);
            p2++;
            p1++;
        }

    }
    return param;
}