Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string str1, str2, str3;
- cout << "Please, enter first string: ";
- cin>>str1;
- int n1=str1.length();
- char vect1[n1];
- for (int i=0; i<n1; i++)
- {vect1[i]=str1[i];}
- cout << "Please, enter second string: ";
- cin>>str2;
- int n2=str2.length();
- char vect2[n2];
- for (int i=0; i<n2; i++)
- {vect2[i]=str2[i];}
- cout << "Please, enter third string: ";
- cin>>str3;
- int n3=str3.length();
- char vect3[n3];
- for (int i=0; i<n3; i++)
- {vect3[i]=str3[i];}
- int i=0, j=0, c=0, k;
- while (i<n1 && j<n3)
- {
- if (vect1[i]!=vect3[j])
- {
- if (c>0)
- {
- k=0;
- while (k<c)
- {
- cout<<vect1[k];
- k++;
- }
- i=0;
- c=0;
- }
- if (c==0)
- {
- cout<<vect3[j];
- j++;
- }
- }
- if (vect1[i]==vect3[j])
- {
- i++;
- j++;
- c++;
- }
- if (c==n1)
- {
- i=0;
- c=0;
- for (int k=0; k<n2; k++)
- cout<<vect2[k];
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement