n,q = [int(i) for i in input().split()]
s = input()
golems = [1] * n

indexes = {}
for i,c in enumerate(s):
    if not c in indexes.keys():
        indexes[c]=[]
    indexes[c].append(i)

for i in range(q):
    t,d = input().split()
    if d == 'R': direc = 1
    else: direc = -1
 
    if not t in indexes.keys():
        indexes[t]=[]
    for j in indexes[t]:
        if 0 <= j+direc < n:
            golems[j+direc] += golems[j]
        golems[j] = 0
 
ans = 0
for g in golems:
    ans += g
print(ans)