Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <stdio.h>
- using namespace std;
- int main()
- {
- char s[100], c[100], s1[100], s2[100];
- cin >> s >> c;
- s1[0] = s[0];
- int n = strlen(s), n1 = 1, n2 = 0;
- for (int i = 1; i < n; i++)
- if (int(c[i] - '0') % 2)
- {
- s1[n1] = s[i];
- n1++;
- }
- else
- {
- s2[n2] = s[i];
- n2++;
- }
- s1[n1] = char(0);
- s2[n2] = char(0);
- for (int i = 0; i < n2 / 2; i++)
- {
- char aux = s2[i];
- s2[i] = s2[n2 - i - 1];
- s2[n2 - i - 1] = aux;
- }
- strcat(s2, s1);
- cout << s2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement