#!/usr/bin/python3

import bisect
import math
import sys


DEBUG = True


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, Q, S, A):
    loc = {a: [] for a in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}
    for i, c in enumerate(S):
        loc[c].append(i)

    A.reverse()
    lb = 0
    rb = N
    for c, d in A:
        arr = loc[c]
        arrlen = len(arr)
        if d == 'L':
            p = bisect.bisect_left(arr, lb)
            if p < arrlen and arr[p] == lb:
                lb += 1
        else:
            p = bisect.bisect_left(arr, rb - 1)
            if p < arrlen and arr[p] == rb - 1:
                rb -= 1

    if rb - lb < 0:
        return 0
    return rb - lb


def main():
    N, Q = [int(e) for e in inp().split()]
    S = inp()
    A = [inp().split() for _ in range(Q)]
    print(solve(N, Q, S, A))


if __name__ == '__main__':
    main()
