Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <algorithm>
- using namespace std;
- const int N = 510;
- char A[N], B[N];
- int main()
- {
- int n, m;
- scanf("%d %s %s%d", &n, A, B, &m);
- while (m--) {
- int l, r;
- scanf("%d%d", &l, &r);
- for (int i = l; i <= r; ++i)
- swap(A[i-1], B[i-1]);
- }
- printf("%s\n", A);
- printf("%s\n", B);
- return 0;
- }
Add Comment
Please, Sign In to add comment