N,Q=map(int,input().split())
s =input()
golem = [[a,1]for a in s]

tmp=0
vanished_golem = 0

# N =6
# Q=1
#
# x ="ABCABC"
# golem = [[a,1]for a in x]
# print(golem)
for q in range(Q):
    pos, direction = input().split()
    if direction == "L":
        for i in range(N):
            if (golem[i][1] >= 1) and golem[i][0] == pos:
                tmp = golem[i][1]

                if i == 0:
                    vanished_golem += tmp
                else:
                    golem[i-1][1] += tmp
                golem[i][1] = 0

    else:
        for i in reversed(range(N)):
            if (golem[i][1] >= 1) and (golem[i][0] == pos):
                tmp = golem[i][1]
                if i == N-1:
                    vanished_golem += tmp
                else:
                    golem[i+1][1] += tmp
                golem[i][1] = 0


print(N-vanished_golem)

