N, Q = list(map(int, input().split()))
s = input()
td = [] #appendのために宣言が必要
for i in range(Q):
    td.append(list(map(str, input().split())))

hash = {}
gl = [1] * len(s)
ans = 0

for c in list(set(s)):
    hash[c] = []

for i, c in enumerate(s):
    hash[c].append(i)

for c, d in td:
    idx = hash[c]
    if d == "L":
        for i in idx:
            if i == 0:
                ans += gl[0]
                gl[0] = 0
            else:
                gl[i-1] += gl[i]
                gl[i] = 0
    else:
        for i in reversed(idx):
            for i in idx:
                if i == len(s) - 1:
                    ans += gl[i]
                    gl[i] = 0
                else:
                    gl[i+1] += gl[i]
                    gl[i] = 0


print(len(s) - ans)