# 2019/03/30
# エクサウィザーズ 2019 - C

# Input
n, q = map(int,input().split())
s = input()
td = list()

for i in range(q):
    td.append(list(input().split()))

lidx = 0
ridx = n-1
ls_c = s[lidx]
rs_c = s[ridx]
lflg = False
rflg = False
llastidx = -1
rlastidx = -1

for i in range(q - 1, -1, -1):
    # Search left
    if td[i][0] == ls_c:
        if td[i][1] == "L":
            lidx += 1
            if lidx < n:
                ls_c = s[lidx]
                llastidx = i
                llastc = s[lidx - 1]
            else:
                lflg = True
                savlidx =  lidx
    
    # Search right
    if td[i][0] == rs_c:
        if td[i][1] == "R":
            ridx -= 1
            if ridx >= 0:
                rs_c = s[ridx]
                rlastidx = i
                rlastc = s[ridx + 1]
            else:
                rflg = True
                savridx =  ridx

for j in range(0, llastidx, 1):
    if td[j][0] == llastc:
        if td[j][1] == "R":
            lidx -= 1
            break

for j in range(0, rlastidx, 1):
    if td[j][0] == rlastc:
        if td[j][1] == "L":
            ridx += 1
            break

if lflg == True:
    lidx = savlidx
if rflg == True:
    ridx = savridx

ans = n - (lidx + ((n - 1) - ridx))

# Output
print(ans)
