N,Q=map(int,input().split())
chr=input()

s=[-1]+[ord(chr[i])-ord("A")+1 for i in range(N)]+[-1]
state=[0]+[1 for i in range(N)]+[0]
print(s)

for i in range(Q):
    a,b=input().split()
    k=ord(a)-ord("A")+1
    for j in range(1,N+1):
        if s[j]==k:
            if b=="R": state[j+1]+=state[j]
            if b=="L": state[j-1]+=state[j]
            state[j]=0

zanki=N-state[0]-state[N+1]

print(zanki)