from copy import deepcopy

N, Q = map(int, input().split())
s = input()
len_s = len(s)
g = [1 for _ in range(len_s)]
index_dict = {c: [] for c in set(s)}
for i, c in enumerate(s):
    index_dict[c].append(i)

def left(g, t):
    l = deepcopy(g)
    index = index_dict[t]
    for i in index:
        if g[i] > 0:
            l[i] -= g[i]
            if i != 0:
                l[i-1] += g[i]
    return l
        
def right(g, t):
    l = deepcopy(g)
    index = index_dict[t]
    for i in index:
        if g[i] > 0:
            l[i] -= g[i]
            if i != len_s - 1:
                l[i+1] += g[i]
    return l

for i in range(Q):
    t, d = map(int, input().split())
    if d == 'L':
        g = left(g, t)
    elif d == 'R':
        g = right(g, t)
    else:
        continue
print(sum(g))