View Code of Problem 55

#include<stdio.h>
#include<string.h>
#define N 30
int main()
{
	int i,k,j;
	char str[N]={'\0'},ch;
    while(~scanf("%s",str))
    {
    getchar();
	scanf("%c",&ch);
    for(i=0;i<strlen(str);i++)
    {
    	k=strlen(str);
    	if(str[i]==ch)
    	{
    		for(j=i;j<k-1;j++)
		    	str[j]=str[j+1];
	    	str[k-1]='\0';
	    	i-=1;
		}
	}
	printf("%s\n",str);
   }
	return 0;
}

Double click to view unformatted code.


Back to problem 55