N,Q = map(int,input().split())
s = input()
info = [input().split() for _ in range(Q)]
bit1 = [0]*26
bit2 = [0]*26
R = ""
L = ""
for t,d in info:
    if d == "L":
        bit1[ord(t)-65] -= 1
        if bit2[ord(t)-65] != 0:
            bit2[ord(t)-65] += 1
        if bit2[ord(t)-65] == 0:
            L += t
    if d == "R":
        bit2[ord(t)-65] -= 1
        if bit1[ord(t)-65] != 0:
            bit1[ord(t)-65] += 1
        if bit1[ord(t)-65] == 0:
            R += t
L = L[::-1]
cnt1 = 0
cnt2 = 0
for r in R[::-1]:
    if r == s[::-1][cnt1]:
        cnt1 += 1
for l in L:
    if l == s[cnt2]:
        cnt2 += 1

ans = max(N - cnt1 - cnt2,0)
print(ans)