a = [int(each) for each in input().split()]

N, Q = a[0], a[1]

state = dict()
s = input()

remains = int(N)

for n in range(int(N)):
    state[n] = {'s': s[n], 'golem': 1}

for q in range(Q):
    t = input().split()
    # 対象マスを選定
    for i, st in enumerate(s):
        if st == t[0]:
            golems = state[i]['golem']
            state[i]['golem'] = 0
            if i == 0 and t[1] == 'L' or i == int(N) - 1 and t[1] == 'R':
                remains -= golems
            else:
                if t[1] == 'R':
                    state[i + 1]['golem'] += golems
                else:
                    state[i - 1]['golem'] += golems
print(remains)
