Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cstring>
- using namespace std;
- int main()
- {
- char s[201],cuv[20];
- cout<<"s=";
- cin.getline(s,201);
- int i=0,k=0,ok,j;
- while(s[i]!='\0'&&s[i]!=' ');
- {
- cuv[k]=s[i];
- i++;
- k++;
- }
- cuv[k]='\0';
- i=j=0;
- while(j<strlen(s))
- { k=0;
- ok=1;
- while(s[j]!='\0'&&s[j]!=' ')
- {
- if(s[j]!=cuv[k])
- ok=0;
- k++;
- j++;
- }
- if(ok==1)
- { if(s[i]!='\0')
- {strcpy(s+i,s+j+1);
- j=i;
- }
- else
- strcpy(s+i,s+j);
- }
- else
- i=j=j+1;
- }
- cout<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement