n,q = map(int,input().split())
s = list(str(input()))
J = []
Al = [
    "A","B","C","D","E",
    "F","G","H","I","J",
    "K","L","M","N","O",
    "P","Q","R","S","T",
    "U","V","W","X","Y","Z"
]
for i in range(26):
    J.append([j for j, x in enumerate(s) if x == Al[i]])
for i in range(q):
    t,d = map(str,input().split())
    k = Al.index(t)
    if d == "L":
        J[k] = [i - 1 for i in J[k] if i - 1 >= 0]
    elif d == "R":
        J[k] = [i + 1 for i in J[k] if i + 1 <= n - 1]
    #print(J)
ans = 0
for i in range(26):
    ans += len(J[i])
print(ans)