n,q = map(int,input().split())
s = list(input())
o = [1 for  i in range(n)]
t = []
r = []
for i in range(q):
    a,b = map(str,input().split())
    if a not in t:
        t.append(a)
        r.append([i for i, x in enumerate(s) if x == a])
    index1 = t.index(a)
    if b == "L":
        for i in range(len(r[index1])):
            if r[index1][i] == 0:
                n = n - o[0]
                o[0] = 0
            else:
                o[r[index1][i]-1] += o[r[index1][i]]
                o[r[index1][i]] = 0
    else:
        for i in range(len(r[index1])):
            if r[index1][i] == len(s)-1:
                n = n - o[-1]
                o[-1] = 0
            else:
                o[r[index1][i]+1] += o[r[index1][i]]
                o[r[index1][i]] = 0

print(n)