# coding: utf-8
n, q = map(int, input().split())
s = list(input())
char_data = [[] for i in range(26)]
cnt = 1
for i in s:
    char_data[ord(i) - 65].append(cnt)
    cnt += 1

g = [1 for i in range(n + 2)]
g[0] = 0
g[-1] = 0

num = 0

for i in range(q):
    char, way = map(str, input().split())
    if way == 'L':
        for j in char_data[ord(char) - 65]:
            if g[j] != 0:
                num = g[j]
                g[j] = 0
                g[j-1] += num
    else:
        for k in char_data[ord(char) - 65]:
            if g[k] != 0:
                num = g[k]
                g[k] = 0
                g[k+1] += num
    print(g)

print(char_data)
print(g)
print(n - (g[0]+g[-1]))
