n, q = map(int, input().split())
s = input()
td = []
for i in range(q):
    td.append(list(input().split()))

count = {}
for i in range(n):
    if s[i] in count.keys():
        count[s[i]].append(i)
    else:
        count[s[i]] = [i]

num = [1] * n
vanish = 0
for i in range(q):
    magic = td[i]
    if magic[0] not in count.keys():
        continue
    if magic[1] == "L":
        for j in count[magic[0]]:
            if j == 0:
                vanish += num[0]
                num[0] = 0
            else:
                num[j-1] += num[j]
                num[j] = 0
    else:
        for j in count[magic[0]]:
            if j == n-1:
                vanish += num[n-1]
                num[n-1] = 0
            else:
                num[j+1] += num[j]
                num[j] = 0
print(n-vanish)