def rback(i):
    k = 1
    j = i-1
    m = 2
    while j>=0:
        if A[j]==[S[-1],"R"]:break
        if A[j]==[S[-m],"R"]:
            k += 1
            m += 1
        j -= 1
    return k
def lback(i):
    k = 1
    j = i-1
    m = 1
    while j>=0:
        if A[j]==[S[0],"L"]:break
        if A[j]==[S[m],"L"]:
            k += 1
            m += 1
        j -= 1
    return k
N,Q = map(int,input().split())
S = input().strip()
A = [input().split() for _ in range(Q)]
k1 = 0
k2 = 0
cnt = 0
for i in range(Q):
    if A[i]==[S[-1],"R"]:
        n = rback(i)
        if n>k1 and k1+k2<=N:
            cnt += (n-k1)
            k1 = n
    elif A[i]==[S[0],"L"]:
        n = lback(i)
        if n>k2 and k1+k2<=N:
            cnt += (n-k2)
            k2 = n
print(N-cnt)