#include using namespace std; int main() { cin.tie(0);ios::sync_with_stdio(false); int N,M; cin >> N >> M; //左右にバッファを持たせた配列 vector A(N); for(int i = 0; i < N; ++i) cin >> A[i]; string S; cin >> S; for(char& c:S){ if(c=='L'){ for(int i = 1; i < N; ++i) A[i-1] += A[i],A[i] = 0; } else{ for(int i = N-2; 0 <= i; --i) A[i+1] += A[i],A[i] = 0; } } for(int i = 0; i < N; ++i) cout << A[i] << " "; cout << endl; return 0; }