import numpy as np

n, q= map(int, input().split())
s = input()

masu = np.ones(n)

for i in range(q):
    t, d = map(str, input().split())
    
    #right
    if d == "R":
        for j in range(n):
            if s[j] == t:
                if masu[j] > 0:
                    if j != n-1:
                        tmp = masu[j]
                        masu[j] = 0 
                        masu[j+1] += tmp
                    else:
                        masu[j] = 0
    #left
    else:
        for j in range(n):
            if s[j] == t:
                if masu[j] > 0:
                    if j != 0:
                        tmp = masu[j]
                        masu[j] = 0
                        masu[j-1] += tmp
                    else:
                        masu[j] = 0
print(int(np.sum(masu)))
