#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, m; cin >> n >> m; deque a(n); rep(i, n) cin >> a[i]; string s; cin >> s; for (char c : s) { if (c == 'L') { int t = a.front(); a.pop_front(); a.front() += t; a.push_back(0); } if (c == 'R') { int t = a.back(); a.pop_back(); a.back() += t; a.push_front(0); } } rep(i, n) cout << a[i] << ' '; cout << '\n'; return 0; }