using System;
using System.Collections.Generic;
using static Assistant.Input;
using System.Linq;
using Assistant;

namespace エクサウィザーズC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt;
            var Q = ReadInt;

            var S = Console.ReadLine();

            char[] t = new char[Q];
            char[] d = new char[Q];
            for (int i = 0; i < Q; i++)
            {
                var input = Console.ReadLine().Split();
                t[i] = input[0][0];
                d[i] = input[1][0];
            }

            int[] dpR = new int[Q + 1];
            dpR[Q] = N;
            int[] dpL = new int[Q + 1];
            dpL[Q] = -1;

            for (int i = Q; i > 0; i--)
            {
                int posR = dpR[i] - 1;
                if (t[i - 1] == S[posR] && d[i - 1] == 'R') dpR[i - 1] = posR;
                else dpR[i - 1] = dpR[i];

                int posL = dpL[i] + 1;
                if (t[i - 1] == S[posL] && d[i - 1] == 'L') dpL[i - 1] = posL;
                else dpL[i - 1] = dpL[i];
            }


            int vR = N - dpR[0];
            int vL = dpL[0] + 1;
            Console.WriteLine(N - vR - vL);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        //drawmap
        //drawarray
    }
}
