n , q = list(map(int,input().split()))
s = input()
count = 0
sub = 0
tile = [1 for i in range(n)]
for i in range(q):
    print(tile)
    q1, q2 = list(input().split())
    for j in range(n):
        if s[j] == q1 and tile[j] > 0:
            sub = tile[j]
            tile[j] -= sub
            if q2 == 'L':
                if j - 1 < 0:
                    count += sub
                else:
                    tile[j - 1] += sub
            else:
                if j + 2 > len(tile):
                    count += sub
                else:
                    tile[j + 1] += sub
print(tile)
print(n - count)