#include #define rep(i,n) for(int i = 0; i < (n); ++i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) using namespace std; typedef long long int ll; typedef pair P; #define yn {puts("YES");}else{puts("NO");} #define MAX_N 200005 int main() { int n, m; cin >> n >> m; int a[n]; rep(i,n)cin >> a[i]; string s; cin >> s; int x = 0; int y = n-1; int now = 0; int nowx = 0; int nowy = n - 1; rep(i,m){ if(s[i] == 'L'){ now--; nowx--; nowy--; }else{ now++; nowx++; nowy++; } x = max(x, -now); y = min(y, n-1-now); nowx = max(nowx, 0); nowx = min(nowx, n-1); nowy = max(0, nowy); nowy = min(n-1,nowy); } int ans[n] = {}; rep(i,n){ if(i <= x){ ans[nowx] += a[i]; }else if(i >= y){ ans[nowy] += a[i]; }else{ ans[i+now] += a[i]; } } rep(i,n){ cout << ans[i]; if(i == n - 1)cout << endl; else cout << ' '; } return 0; }