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:
    try:
        cap_loc = where[spell[0]]
        if spell[1] == 'R':
            param = 1
        else:
            param = -1
        for index in cap_loc:
            if status[index] >= 1:
                stay = status[index]
                status[index] -= stay
                index += param
                if index == -1 or index >= N:
                    continue
                else:
                    status[index] += stay
        
    except KeyError:
        cap_loc = []
        if s.count(spell[0]) != 0:
            index = s.find(spell[0])
            for _ in range(N):
                cap_loc.append(index)
                index = s.find(spell[0], index+1)
                if index == -1:
                    break
            where[spell[0]] = cap_loc
            if spell[1] == 'R':
                param = 1
            else:
                param = -1
            for index in cap_loc:
                if status[index] >= 1:
                    stay = status[index]
                    status[index] -= stay
                    index += param
                    if index == -1 or index >= N:
                        continue
                    else:
                        status[index] += stay

answer = sum(status)
print(answer)
