formygloryandpeacefulday  

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';

}

posted on 2024-11-21 21:56  残夏便是结局  阅读(12)  评论(0)    收藏  举报