![]() |
#2
左手拉一只猫2013-12-01 17:08
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int reduce (char s[])
{
int len=strlen(s);
char *scopy;
scopy=(char *)malloc((len+1)*sizeof(char));
while(*(s+1)!='\0')
{
if(*s!=*(s+1))
*scopy++=*s;
s++;
}
strcpy(s,scopy);
return len-strlen(scopy);
}
void main()
{
char ss[]={"Press***12225"};
int r;
r=reduce(ss);
printf("%d\n",r);
}