from sys import stdin

data_nq = stdin.readline().rstrip().split()
s = str(stdin.readline().rstrip())
N = int(data_nq[0])
Q = int(data_nq[1])
# # print(data_nq[1])
# print("s:",s)
data_spell = [stdin.readline().rstrip().split() for _ in range(0,Q)]
# print(data_spell)

num = []
lost = 0

for itr in range(0,N):
    num.append(1)
# print(num)

for itr in data_spell:
    # print("itr:", itr)
    for spaceItr in range(len(s)):
        # print("spaceItr:", spaceItr)
        if s[spaceItr] == itr[0]:
            if itr[1] == "R":
                if (spaceItr+1) >= N:
                    lost += num[spaceItr]
                    num[spaceItr] = 0
                    # print("lost:",lost)
                else:
                    num[spaceItr + 1] += num[spaceItr]
                    num[spaceItr] = 0
            elif itr[1] == "L":
                if (spaceItr-1) < 0:
                    lost += num[spaceItr]
                    num[spaceItr] = 0
                    # print("lost:",lost)
                else:
                    num[spaceItr - 1] += num[spaceItr]
                    num[spaceItr] = 0
    # print("num:", num)
print(N-lost)
