import collections

N, Q = [int(x) for x in input().strip().split()]
s = input().strip()

status = collections.Counter()
for i, s_ in enumerate(s):
    if(status[s_] == 0):
        status[s_] = []
    status[s_].append(i+1) 
    
gorems = [1 for i in range(N+2)]
gorems[0] = 0
gorems[-1] = 0

for q in range(Q):
    t = input().strip().split()
    if(status[t[0]] != 0):
        if(t[1] == "R"):
            for index in status[t[0]][::-1]:
                gorems[index + 1] += gorems[index] 
                gorems[index] = 0
        elif(t[1] == "L"):
            for index in status[t[0]]:
                gorems[index - 1] += gorems[index] 
                gorems[index] = 0
print(sum(gorems[1:-1]))