# import logging

# logger = logging.getLogger(__name__)
# logger.setLevel(logging.INFO)
# h = logging.FileHandler("logtest.log")
# logger.addHandler(h)

N, Q = map(int, input().split())
S = list(map(str, input().strip()))
# logger.info("S: {}".format(S))

order = [tuple(map(str, input().split())) for _ in range(Q)]
order = order[::-1]
# logger.info("order: {}".format(order))

# left: 左に落ちるゴーレム
# right: 右に落ちるゴーレム
#  N-right-left: 生き残るゴーレム
left, right = 0, N - 1
# logger.info("left: {}, right: {}".format(left, right))

# 二分探索
for a in order:
    t, d = a[0], a[1]
    # logger.info("t: {}, d: {}".format(t, d))
    # logger.info("[before] left: {}, right: {}".format(left, right))

    if d == "L":
        if S[left] == t:
            left += 1
            if left > N - 1:
                pass

        if right < N - 1 and S[right + 1] == t:
            right = min(N - 1, right + 1)

    else:
        if left > 0 and S[left - 1] == t:
            left = max(0, left - 1)

        if S[right] == t:
            right -= 1
            if right < 0:
                pass

    # logger.info("[after] left: {}, right: {}\n".format(left, right))


print(right - left + 1)
