n,q = map(int,input().split())
s = list(input())
t = []
d = []
for i in range(q):
    t1,d1 = list(input().split())
    t.append(t1)
    d.append(d1)
    
ALF = []
for i in range(26):
    ALF.append([])

g = []
for i in range(len(s)+2):
    g.append(1)

for i in range(len(s)):
    ALF[ord(s[i])-65].append(i)

for i in range(q):
    if d[i] == "R":  
        for j in reversed(range(len(ALF[ord(t[i])-65]))):
            g[ALF[ord(t[i])-65][j]+1+1] += g[ALF[ord(t[i])-65][j]+1]
            g[ALF[ord(t[i])-65][j]+1] = 0
    else:
        for j in range(len(ALF[ord(t[i])-65])):
            g[ALF[ord(t[i])-65][j]-1+1] += g[ALF[ord(t[i])-65][j]+1]
            g[ALF[ord(t[i])-65][j]+1] = 0

ans = 0
for i in range(1,len(s)+1):
    ans += g[i]
print(ans)