n,q= map(int,input().split())
s = input()
g = [1 for x in s]
a = len(s)
lost = 0
for i in range(q):
    t,d = input().split()
    if d == "L":
        for j in range(a):
            if t == s[j]:
                if j == 0:
                    lost += g[0]
                    g[0]=0
                else:
                    g[j-1]+=g[j]
                    g[j]=0

    if d == "R":
        for j in reversed(range(a)):
            if t == s[j]:
                if j == a-1:
                    lost += g[a-1]
                    g[a-1]=0
                else:
                    g[j+1]+=g[j]
                    g[j]=0
#    print(g)
print(a-lost)