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

for i in range(q):
    t,d = input().split()
    if d == 'R': direc = 1
    else: direc = -1

    for j in range(n):
        if s[j] == t:
            if 0 <= j+direc < n:
                golems[j+direc] += golems[j]
            golems[j] = 0

ans = 0
for g in golems:
    ans += g
print(ans)