Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char s1[100] = "ac";
- char s2[500] = "ana are un ac. acum merg acasa! dar inainte voi merge la magazin de unde o sa-mi iau un_ac_si un acordeon.";
- char s3[500]; strcpy(s3, s2);
- char *p = strstr(s2, s1);
- while(p != NULL)
- {
- //cout << p << "\n";
- int c = p - s2;
- if(!(p[2] >= 'a' && p[2] <= 'z'))
- {
- strcpy(s3+c, s3+c+strlen(s1));
- }
- c += strlen(s1);
- p = strstr(s2 + c, s1);
- }
- cout << s3;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement