-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Homework.cpp
More file actions
44 lines (42 loc) · 884 Bytes
/
A_Homework.cpp
File metadata and controls
44 lines (42 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i = 0;i < n;i++)
#define sr(a) sort(a.begin(),a.end())
#define srd(a) sort(a.begin(),a.end(),greater<int>())
#define ll long long
const int N = 1e7;
#define all(a) a.begin(),a.end()
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s;
cin>>s;
int m;
cin>>m;
string b;
cin>>b;
string c;
cin>>c;
string f = "";
for(int i =0; i < m;i++){
if(c[i] == 'V'){
f+=b[i];
}
else {
s+=b[i];
}
}
reverse(f.begin(),f.end());
for(int i = 0;i < s.length();i++){
f+=s[i];
}
cout<<f<<endl;
}
return 0;
}