import sys
input = sys.stdin.readline

N, Q = map(int, input().rstrip().split())
s = input().rstrip()
where = {}
status = [1]*N
spells = [input().rstrip().split() for _ in range(Q)]

for spell in spells:
    now = spell[0]
    if now not in where:
        cap_loc = []
        if s.count(now) != 0:
            index = s.find(now)
            for _ in range(N):
                cap_loc.append(index)
                index = s.find(now, index+1)
                if index == -1:
                    break
        where[now] = cap_loc
    cap_loc = where[now]

    if spell[1] == 'R':
        param = 1
    else:
        param = -1

    for index in cap_loc:
        if status[index] >= 1:
            stay = status[index]
            status[index] = 0
            index += param
            if index == -1 or index >= N:
                continue
            else:
                status[index] += stay


answer = sum(status)
print(answer)
