Problem Description
C program to remove all occurrences of a character from the stringCODING ARENA
#include <stdio.h>
#include<string.h>
int main()
{
char str[10];
char ch;int i,size;
scanf("%s %c",str,&ch);
size=strlen(str);
for(i=0;i<size;i++)
{
if(str[i]!=ch)
printf("%c",str[i]);
}
return 0;
}
Test Case 1
Input (stdin)madam a
Expected Outputmdm
Test Case 2
Input (stdin)SRMSRMSRM S
Expected OutputRMRMRM
No comments:
Post a Comment