n, q = map(int, input().split())
s = input()
a = [[x for x in input().split()] for _ in range(q)]
g = [1] * n
set_s = list(set(s))
d= dict()
def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]
for i in set_s:
    d[i] = my_index_multi(s, i)
for j in a:#呪文
    for i in d[j[0]]:
        if j[1] == "R":
            if i == n-1:
                g[n-1] = 0
            else:
                g[i+1] += g[i]
                g[i] = 0
        elif j[1] == "L":
            if i == 0:
                g[0] = 0
            else:
                g[i-1] += g[i]
                g[i] = 0

                
print(sum(g))