import numpy as np
N, Q = (int(i) for i in input().split())  
s = np.array(list(input()))
idxs = {}
for i, ss in enumerate(s):
    l = idxs.get(ss, np.array([], dtype = 'int32'))
    idxs[ss] = np.append(l, [i])
g = np.array([1]*(N+1))
for i in range(Q):
    t, d = input().split()
    x = 1 if d == 'R' else -1
    idx = idxs.get(t, [])
    if len(idx) > 0:
        tmp = g[idx]
        g[idx] = 0
        g[idx + x] = g[idx + x] + tmp
        g[N] = 0
print(sum(g))