#!/usr/bin/env python3 from typing import * def solve(n: int, m: int, a: List[int], s: str) -> Any: l = 0 r = n cnt_l = 0 cnt_r = 0 for c in s: if c == 'L': if l == 0: cnt_l += 1 else: l -= 1 r = max(1, r - 1) elif c == 'R': l = min(n - 1, l + 1) if r == n: cnt_r += 1 else: r += 1 else: assert False b = [0] * n for i in range(n): if i < cnt_l: b[l] += a[i] elif cnt_l <= i and i < n - cnt_r: b[l + i - cnt_l] += a[i] else: b[r - 1] += a[i] return b # generated by online-judge-template-generator (https://github.com/kmyk/online-judge-template-generator) def main(): import sys tokens = iter(sys.stdin.read().split()) N = int(next(tokens)) M = int(next(tokens)) a = [None for _ in range(N)] for i in range(N): a[i] = int(next(tokens)) S = next(tokens) assert next(tokens, None) is None ans = solve(N, M, a, S) print(*ans) if __name__ == '__main__': main()