import numpy
n, q = (int(i) for i in input().split())  
s = list(input())
td = [[i for i in input().split()] for i in range(q)]
r = s.count("R")
b = s.count("B")
golem = list(numpy.ones(n))
for i in range(q):
    ti = td[i][0]
    di = td[i][1]
    addresses = [j for j, tj in enumerate(s) if tj == ti]
    for address in addresses:
        if (address == 0 and di == "L") or (address == n-1 and di == "R"):
            golem[address] = 0
        elif di == "L":
            golem[address-1] += golem[address]
            golem[address] = 0
        elif di == "R":
            golem[address+1] += golem[address]
            golem[address] = 0
            
print(int(sum(golem)))