def gcd_core(a,b):
    if b == 0:
        return a
    else:
        return gcd_core(b,a%b)

def gcd(arr):
    g = gcd_core(arr[0],arr[1])
    for i in range(2,len(arr)):
        g = gcd_core(g,arr[i])
    return g

n,q = map(int,input().split())
s = input()
que = []
falling = []
for i in range(q):
    que.append(list(input().split()))
que = que[::-1]
ans = 0
for line in que:
    l = s[0]
    r = s[-1]
    if line[0]==l and line[1] == "L":
        ans += 1
        s = s[1:]
    elif line[0]==r and line[1] == "R":
        ans += 1
        s = s[:-1]
print(n-ans)
