import numpy as np
N,Q = list(map(int,input().split()))
s = input()

A = np.zeros([26,N])

for i in range(N):
    A[ord(s[i])-65,i] = 1

golems = np.ones(N).astype(np.int)
for i in range(Q):
    t,d = input().split()
    # print(golems)
    if d == "L":
        moved = [g if a else 0 for g,a in zip(golems,A[ord(t)-65])][1:]+[0]
        stayed =[g if not a else 0 for g,a in zip(golems,A[ord(t)-65])]
    else:
        moved = [0]+[g if a else 0 for g,a in zip(golems,A[ord(t)-65])][:-1]
        stayed =[g if not a else 0 for g,a in zip(golems,A[ord(t)-65])]
    # print(moved)
    # print(stayed)
    golems = [m+s for m,s in zip(moved,stayed)]
#     print("---")
# print(golems)
print(sum(golems))