Advertisement
a53

Codificare

a53
Jan 3rd, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #define N 100
  4. using namespace std;
  5. int main()
  6. {
  7. char s[N],c[N],sc[N];
  8. cin>>s>>c;
  9. int L=strlen(c),poz=0;
  10. for(int i=L-1;i>=0;--i)
  11. if((c[i]-'0')%2==0)
  12. sc[poz++]=s[i];
  13. for(int i=0;i<L;++i)
  14. if((c[i]-'0')%2)
  15. sc[poz++]=s[i];
  16. sc[poz]='\0';
  17. if(poz==(int)strlen(s))
  18. cout<<sc<<'\n';
  19. else
  20. cout<<"cod incorect"<<'\n';
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement