N, Q = map(int, input().split())
s = input()
T = []
D = []
for i in range(Q):
    t, d = input().split()
    T.append(t)
    D.append(d)

s_idx = {}
s_inv = {}
for i in range(N):
    if(s[i] in s_idx):
        s_idx[s[i]] = s_idx[s[i]] + [i]
        s_inv[s[i]] = [i] + s_idx[s[i]]
    else:
        s_idx[s[i]] = [i]
        s_inv[s[i]] = [i]
#print("s_idx={}".format(s_idx))

golems = [1] * N
g_num = N
for idx in range(Q):
#    print("spl={}, {}".format([T[idx], D[idx]], T[idx] in s_idx))
    if(True != (T[idx] in s_idx)):
        continue
    if("L" == D[idx]):
        for i in s_idx[T[idx]]:
            if(0 == i):
                g_num -= golems[i]
            else:
                golems[i - 1] += golems[i]
            golems[i] = 0
    elif("R" == D[idx]):
        for i in s_inv[T[idx]]:
            if(N - 1 == i):
                g_num -= golems[i]
            else:
                golems[i + 1] += golems[i]
            golems[i] = 0

print(str(g_num))
