#include #include #include using namespace std; int main() { int n, m; cin >> n >> m; vector a(n); for (int i = 0; i < n; i++)cin >> a[i]; string s; cin >> s; int left = 0, right = n - 1, now = 0; for (int i = 0; i < m; i++) { if (s[i] == 'L')now++; else now--; now = min(now, n - 1), now = max(now, -(n - 1)); left = max(left, now), right = min(right, now + n - 1); } for (int i = 0; i < left; i++) a[left] += a[i], a[i] = 0; for (int i = n - 1; i > right; i--) a[right] += a[i], a[i] = 0; for (int i = 0; i < n; i++) { if (i > 0)cout << " "; if (0 <= i + now && i + now < n) cout << a[i + now]; else cout << 0; } cout << endl; return 0; }