N, Q = map(int, input().split())
s = input()

golems_in = dict([(i, 1) for i in range(N+2)])
golems_in[0] = 0
golems_in[N+1] = 0
alphabet_to_number = {}
for i in range(N):
    c = s[i]
    if not c in alphabet_to_number:
        alphabet_to_number[c] = [i + 1]
    else:
        alphabet_to_number[c].append(i + 1)

for i in range(Q):
    t, d = input().split()
    direction = 1 if d=="R" else -1
    n = len(alphabet_to_number[t]) if t in alphabet_to_number else 0
    for j in range(n):
        if(d == "R"):
            c = alphabet_to_number[t][n-j-1]
        else:
            c = alphabet_to_number[t][j]
        golems_in[c+direction] += golems_in[c]
        golems_in[c] = 0
print(N-golems_in[0]-golems_in[N+1])