n, q = list(map(int,input().split()))
s = list(input())
li = [list(input().split()) for i in range(q)]

g = [0] + [1] * n + [0]

for i in range(q):
    b = [k for k, x in enumerate(s) if x == li[i][0]]
    for j in range(len(b)):
        if g[b[j] + 1] == 0:
            continue
        else:
            x = g[b[j] + 1]
            g[b[j] + 1] = 0
            if li[i][1] == "R":
                g[b[j] + 2] += x
            else:
                g[b[j]] += x

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