#!/usr/bin/env python3
import sys


def solve(N: int, Q: int, s: str, t: "List[str]", d: "List[str]"):
    l = 0
    r = N - 1
    for i in range(Q):
        idx = Q - i - 1
        c = t[idx]
        if r >= 0 and d[idx] == 'R' and s[r] == c:
            r -= 1
        elif l < N and d[idx] == 'L' and s[l] == c:
            l += 1
    ret = max(0, N - l - (N - r - 1))
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    s = next(tokens)  # type: str
    t = [str()] * (Q)  # type: "List[str]" 
    d = [str()] * (Q)  # type: "List[str]" 
    for i in range(Q):
        t[i] = next(tokens)
        d[i] = next(tokens)
    solve(N, Q, s, t, d)

if __name__ == '__main__':
    main()
