import numpy as np
N, Q = (int(i) for i in input().split())  
s = list(input())
s_set = set(s)
idx = {}
for ss in list(s_set):
    idx[ss] = np.array([i for i, _x in enumerate(s) if _x == ss])
g = np.array([1]*(N+1))
for i in range(Q):
    t, d = input().split()
    x = 1 if d == 'R' else -1
    if t not in s_set:
        continue
    tmp = g[idx[t]]
    g[idx[t]] = 0
    g[idx[t] + x] = g[idx[t] + x] + tmp
    g[N] = 0
print(sum(g))