#include<stdio.h>
#include<stdlib.h>
int RemoveCommon(const char * input ,char *output)
{
if(!input || !output)
{
printf("the input or the output is null\n");
exit(-1);
}
int k=0;
int i;
while( *input !='\0')
{
for(i=0;i<k;i++)
{
if(*input ==output[i] )
break;
}
if( !(i<k))
{
output[k]=*input;
k++;
}
input++;
}
output[k]='\0';
}
int main()
{
char src[10];
scanf("%s",src);
char dest[10];
RemoveCommon(src, dest);
printf("the resultis %s\n",dest);
return 1;
}
删除字符串中重复字符
最新推荐文章于 2022-12-24 14:56:11 发布