View Code of Problem 55

#include <iostream>
//#include<stdio.h>
#include<string.h>

int main(int argc, char** argv) {
	char str[20];
	scanf("%s" , &str);
//	gets(str);
	
	char c ;
	scanf("%c" , &c);
	scanf("%c" , &c);
	
	int i = 0, j = 0 ;

	int length = strlen(str);
	
		
	for(i = 0 ; i<length ; i++){
		if(str[i] != c){
			str[j++] = str[i];
		}else{
			str[j] = str[i];
		}
	}
	str[j] = '\0';
	for(i = 0 ; i<strlen(str) ; i++){
		printf("%c",str[i]);
	}
	return 0;
}






Double click to view unformatted code.


Back to problem 55