def getN():
    return int(input())

def getlist():
    return [int(x) for x in input().split()]

n, q = getlist()
sin = " " + input() + " "
oprs = []
lsafe = 1
rsafe = n
lborder = sin[:2]
rborder = sin[-2:]

for i in range(q):
    oprs.append(input().split())
for opr in oprs[::-1]:
    #print(lsafe, lborder, rsafe, rborder, opr)
    if opr[1] == "L":
        if opr[0] == lborder[1]:
            lsafe += 1
            lborder = lborder[1] + sin[lsafe]
        if opr[0] == rborder[1]:
            rsafe += 1
            rborder = rborder[1] + sin[rsafe+1]
    else: #opr = R
        if opr[0] == rborder[0]:
            rsafe -= 1
            rborder = sin[rsafe] + rborder[0]
        if opr[0] == lborder[0]:
            lsafe -= 1
            lborder = sin[lsafe-1] + lborder[0]

    if rsafe < lsafe:
        break
print(rsafe-lsafe+1)
