n,q = map(int,input().split())
ss = input()
s_detail = {}
for i,s in enumerate(ss):
    s_detail.setdefault(s,[]).append(i)
gors = [1] * n
ss_len = len(ss)

for i in range(q):
    s,t = input().split()
#     if not s_detail.get(s):
#         continue
    try:
        for pos in s_detail[s]:
            if gors[pos] == 0:
                continue
            elif pos == 0 and t == "L":
                gors[0] = 0
            elif pos == ss_len - 1 and t == "R":
                gors[-1] = 0
            else:
                gors[pos + (1 if t == "R" else -1)] += gors[pos]
                gors[pos] = 0
    except Exception:
        pass
#     print(gors)

# print(gors)
print(sum(gors))