Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to compress C language strings
How to compress C language strings
In other words, array B can't be plastic, otherwise the letters can't be saved. This is my code. . .

# Contains? & ltiostream & gt

# Contains? & ltstring.h & gt

# Contains? & ltstdio.h & gt

Use? Namespace? std

Invalid? yasuo(char? a[],char? b[])

{

int? count= 1,p = 0;

for(int? I = 0; ? I< strlen (a); ? i++)

if(a[i]==a[i+ 1])

count++;

Or what? if(count & gt; 2)

{

b[p++]=(char)(count+' 0 ');

b[p++]= a[I];

count = 1;

}

Or what? if(count==2)

{

b[p++]= a[I];

b[p++]= a[I];

count = 1;

}

other

b[p++]= a[I];

}

Invalid? printB(char? b[])

{

cout & lt& ltb & lt& ltendl

}

Invalid? back(char? b[])

{

for(int? I = 0; ? I< strlen (b); ? i++)

if(b[I]& lt; = ' 9 ' & amp& ampb[I]& gt; ='3')

{

for(int? j = 0; ? j & lt(int)(b[I]-' 0 '); ? j++)

cout & lt& ltb[I+ 1];

i++;

}

other

cout & lt& ltb[I];

cout & lt& ltendl

}

int? Master ()

{

Charles? a[ 1000]=? {0},b[ 1000]=? {0};

Get (a);

Yasuo (A, B);

printB(b);

back(b);

}