#include<iostream.h>
#include<string.h>
void main()
{ char s[255];
char a[255]="";
char *p;
cin>>s;
int i=0;
while(s[i]!='*')
{ a[i]=s[i];
i++;
}
a[i+1]='\0';
strcpy(s,s+i);
p=strstr(s,a);
while(strstr(p,a))
{ p=strstr(p,a);
if((p-1)[0]=='*' && (p+strlen(a))[0]=='*')
strcpy(p,p+strlen(a));
else p=p+strlen(a);
}
cout<<s;
}
sau
include<fstream.h>
#include<string.h>
ifstream fin("sir.in");
void main()
{ cout<<endl;
char s[255], x[30];
fin.get(x,30,'*');
while(!fin.eof())
{ fin.get();
fin.get(s,255,'*');
if(strcmp(x,s)!=0) cout<<"*"<<s;
else cout<<"*";
}
}
|