N,Q = (int(i) for i in input().split())
s = list(input())
list1 = [] #[[A,L]]
for i in range(Q):
  j = [str(h) for h in input().split()]
  list1.append(j)
a = list1.count([s[0],"L"])
b = list1.count([s[N-1],"R"])
print(N - (a + b))