View Code of Problem 55

#include<stdio.h>
#include<string.h>
main(){
	char str1[100],str2[100],c;
	int i,j=0,len;
	scanf("%s",str1);
	len=strlen(str1);
	getchar();          //消除空格,防止当做字符c输入
	scanf("%c",&c);
	for(i=0;i<len;i++){
		if(str1[i]!=c){
			str2[j]=str1[i];
			j++;
		
		}
	}
	str2[j]='\0';
	printf("%s",str2);
	printf("\n");
}

Double click to view unformatted code.


Back to problem 55