View Code of Problem 55

#include<stdio.h>
#include<string.h>
int main()
{
	char ch[100];
	char c;
	gets(ch);
	c = getchar();
	int n = strlen(ch);
	int i,j;
	for(i=n-1;i>=0;i--)
	{
		if( ch[i]==c && (ch[i+1]!=c || ch[i+1]=='\0') )
		{
			for(j=i;j<n;j++)
			{
				ch[j] = ch[j+1];
			}
		}
	}
	puts(ch);
	return 0;
 } 

Double click to view unformatted code.


Back to problem 55