Advertisement
nicuvlad76

Untitled

Nov 16th, 2020
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #define N 1001
  4. using namespace std;
  5. char s[N], c[N],t[N];
  6. int n,m,k,i;
  7. int main()
  8. {
  9.  
  10. cin>>s;
  11. cin>>c;
  12. n=strlen(s);
  13. m=strlen(c);
  14. if(n!=m) {cout<<"cod incorect"; return 0;}
  15. for(i=n-1;i>=0;i--)
  16. if(c[i]%2==0) ///'0' -48
  17. t[k++]=s[i];
  18. for(i=0;i<n;i++)
  19. if(c[i]%2==1)t[k++]=s[i];
  20. t[k]=NULL;
  21. cout<<t;
  22. return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement