include
using namespace std;
define max 80
void zip(char* p);
int main989()
{
char line[max];
cout << "Input the string";
cin>>line;
zip(line);
puts(line);
return 0;
}
void zip(char* p)
{
char* q = p;
int n;
while (p != '\0')
{
n = 1;
while (p == *(p + n))
{
n++;
}
if (n >= 10)
{
*q++ = (n / 10) + '0';
*q++ = (n % 10) + '0';
}
else
{
if (n >= 2)
{
*q++ = n + '0';
}
}
*q++ = *(p + n - 1);
p = p + n;
}
*q = '\0';
}

浙公网安备 33010602011771号