n,q=list(map(int,input().split()))
s="0"+input()+"0"
tb=[0]+[1 for i in range(n)]+[0]
for i in range(q):
    t,d=input().split()
    d=int(d=="R")
    k=0
    for j in range([n,1][d],[-1,n+2][d],2*d-1):
        if s[j] == t:
            k,tb[j]=tb[j],k
        else:
            tb[j]+=k
            k=0
print(n-tb[0]-tb[-1])