import numpy as np

N, Q = (int(i) for i in input().split())
s = input()

td = []

for i in range(Q):
    t, d = (i for i in input().split())
    td.append([t, d])

# -----------------------------

s_list = [0] * N

for index, st in enumerate(s):  # 2*10^5
    s_list[index] = ord(st) - ord("A")

s_list = np.array(s_list)

where = []

for i in range(26):
    where.append(np.where(s_list == i)[0])

where = np.array(where) + 1
# -----------------------------
counter_array = np.array([1] * (N + 2))

for i in range(Q):
    if(td[i][1] == "L"):
        shift = -1
    else:  # R
        shift = 1
    tmp = counter_array[where[ord(td[i][0]) - ord("A")]]
    counter_array[where[ord(td[i][0]) - ord("A")] +
                  shift] += counter_array[where[ord(td[i][0]) - ord("A")]]
    counter_array[where[ord(td[i][0]) - ord("A")]] -= tmp
    #print(counter_array)

print(N - (counter_array[0] + counter_array[-1] - 2))
