N, Q = map(int, input().split())
s = str(input())

t = []
d = []

for _ in range(Q):
    ti, di = map(str, input().split())
    t.append(ti)
    d.append(di)
    
class Golem:
    def __init__(self, number, text):
        self.number = number
        self.text = text
        #self.life = True
        
    def move(self, dist):
        if dist == 'L':
            if self.number == 0:
                return 'DEL'
            else:
                self.number -= 1
                self.text = s[self.number]
                return self.text
        if dist == 'R':
            if self.number == len(s)-1:
                return 'DEL'
            else:
                self.number += 1
                self.text = s[self.number]
                return self.text
                

c_dict = {}
for i, c in enumerate(s):
    if c in c_dict:
        c_dict[c].append(Golem(i, c))
    else:
        c_dict[c] = [Golem(i, c)]
        
for ti, di in zip(t, d):
    if not ti in c_dict:
        continue
    golems = c_dict[ti][:]
    c_dict[ti] = []
    for g in golems:
        res = g.move(di)
        if res != 'DEL':
            c_dict[res].append(g)

#print(c_dict)
ans = 0
for k, v in c_dict.items():
    ans += len(v)
print(ans)

    