import sys
input = sys.stdin.readline

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

s = input()

Query = []
for i in range(Q):
    Query.append(input().split())
#A L
#B L
#B R
#A R



left,right = 0,N-1

## 最終的に生き残っているのをleftとrightにする
## 

for ch,way in reversed(Query):
    #print(left,right,ch,way,s[left],s[right])
    if way == "L":
        if ch == s[left]:
            left += 1
        if right < N-1 and ch == s[right+1]:
            right = min(right + 1,N-1)
        #print("L",left,right,ch,way,s[left],s[right])
    else:
        if left > 0 and ch == s[left-1] :
            left = max(left -1,0)
        if ch == s[right]:
            right -= 1
        #print("R",left,right,ch,way,s[left],s[right])
print(max(0,right-left+1))