/* Tanzila Islam Southeast University mail : tanzilamohita@gmail.com Problem Link : http://codeforces.com/gym/100796/problem/G */ #include<string> #include<iostream> using namespace std; int main () { int n,x,m; string s1, s2; cin >> n >> x >> s1 >> m >> s2; x--; cout << s1[x]; for (int i = 0; i < m; i++){ if (s2[i] == 'R'){ cout << s1[x+1]; x++; } else if (s2[i] == 'L'){ cout << s1[x-1]; x--; } } cout << endl; return 0; }
No comments:
Post a Comment