N,Q = map(int,input().split())
S = list(input())
Num = [i for i in range(1,N+1,1)]
masu = dict(zip(S,Num))
move = 0
count = 0
for i in range(Q):
    t,d = input().split()
    if (d =='L'):
        move = -1
    else:
        move = 1
    masu[t] = masu[t]+move
    if (masu[t] == 0)or(masu[t]==N):
        masu[t] = -10000000
        count += 1
print(N-count)