N,Q = list(map(int,input().split()))
s = str(input())
tlist = []
dlist = []
for i in range(Q):
    t,d = list(map(str,input().split()))
    tlist.append(t)
    dlist.append(d)
    
stat = [1 for i in range(N)]
string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha = {str(string[i]):[] for i in range(len(string)) if string[i] in s}
for i in range(N):
    alpha[s[i]].append(i)

for i in range(Q):
    if dlist[i] == "L":
        for j in range(len(alpha[tlist[i]])):
            temp = stat[alpha[tlist[i]][j]]
            stat[alpha[tlist[i]][j]] = 0
            if alpha[tlist[i]][j] != 0:
                stat[alpha[tlist[i]][j]-1] += temp
    else:
        for j in range(len(alpha[tlist[i]])):
            temp = stat[alpha[tlist[i]][j]]
            stat[alpha[tlist[i]][j]] = 0
            if alpha[tlist[i]][j] != N-1:
                stat[alpha[tlist[i]][j]+1] += temp

print(sum(stat))