Code:
int main()
{
char str1[MAX_PATH];
char str2[MAX_PATH];
cout<<"Enter a string"<<endl;
cin>>str1;
int n1;
n1=strlen(str1);
str1[n1]='\0'; //to ensure null characters are eliminated
cout<<endl;
cout<<"enter a substring to eliminate"<<endl;
cin>>str2;
int n2;
n2=strlen(str2);
str2[n2]='\0'; //to ensure null characters are eliminated
char *pdest;
pdest=strstr(str1,str2);
int result1;
result1=pdest-str1;
int len=strlen(str2);
//loop to print the initials
for(int i=0; i<result1;i++)
{
cout<<str1[i];
}
//print the remaining characters
cout<<pdest+len<<endl;
return 0;
}