N, Q= map(int, input().split())
s = list(input())
td = [input().split() for _ in range(Q)]
didi = {i:[s[i]] for i in range(len(s))}

for li in td:
    t = li[0]
    d = li[1]
    if str(d) == 'L':
        for k, v in didi.items():
            if str(t) in v:
                try:
                    didi[k-1].extend(v)
                    didi[k] = []
                except:
                    didi[k] = []
    if str(d) == 'R':
        for k, v in sorted(didi.items(), key=lambda x: -x[0]):
            if str(t) in v:
                try:
                    didi[k+1].extend(v)
                    didi[k] = []
                except:
                    didi[k] = []

m = 0
for v in didi.values():
    m += int(len(v))
print(m)