#!/bin/env python
# coding: utf-8

import sys
from collections import defaultdict

def main():
    N, Q = [int(x) for x in sys.stdin.readline().strip().split()]
    s = [x for x in list(sys.stdin.readline().strip())]
    survive = N
    spells = [sys.stdin.readline().strip().split() for x in xrange(Q)]

    for initial_idx, c in enumerate(s):
        # simulate 1 by 1
        current_index = initial_idx
        current_char = c

        for spel_char, direction in spells:
            if spel_char != current_char:
                continue
            if direction == "R":
                if current_index == len(s) - 1:
                    survive -= 1
                    break
                else:
                    current_index += 1
                    current_char = s[current_index]
            if direction == "L":
                if current_index == 0:
                    survive -= 1
                    break
                else:
                    current_index -= 1
                    current_char = s[current_index]
    print(survive)


if __name__ == "__main__":
    main()
