# C
n, q = map(int, input().split())
s = str(input())
ls = []
rs = []

for i in range(q):
    t, d = map(str, input().split())
    if d == 'R':
        rs.insert(0, t)
    if d == 'L':
        ls.append(t)
#左から消えるものと右から消えるものを全部考える
count = 0
index = 0
l_max = len(ls)

for c in list(s):
    while not index > l_max-1:
        if ls[index] == c:
            count += 1
        index += 1

index = 0
r_max = len(rs)

for c in list(s)[::-1]:
    while not index > r_max-1:
        if rs[index] == c:
            count += 1
        index += 1

print(count)