using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace exawizards2019C
{
    class Program
    {
        static void Main(string[] args)
        {
            var inp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var N = inp.First();
            var Q = inp.Last();

            var s = Console.ReadLine();
            var g = Enumerable.Repeat(1, N).ToArray();
            var nextG = new int[N];

            var dict = new Dictionary<char, List<int>>();
            var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            var cnt = 0;

            foreach (var c in chars)
            {
                dict.Add(c, new List<int>());
            }

            foreach (var c in s)
            {
                dict[c].Add(cnt++);
            }

            var fail = 0;

            for (; Q > 0; Q--)
            {
                var input = Console.ReadLine();
                var t = input[0];
                var d = input[2];
                foreach (var cell in dict[t].Where(x => x < Q || x >= N - Q))
                {
                    if (d == 'L')
                    {
                        if (cell != 0)
                        {
                            nextG[cell - 1] = g[cell];
                        }
                        else
                        {
                            fail += g[cell];
                        }
                    }
                    else
                    {
                        if (cell != N - 1)
                        {
                            nextG[cell + 1] = g[cell];
                        }
                        else
                        {
                            fail += g[cell];
                        }
                    }
                    g[cell] = 0;
                }

                for (int j = 0; j < Math.Min(Q, N); j++)
                {
                    g[j] += nextG[j];
                    nextG[j] = 0;
                }

                for (int j = Math.Max(N - Q - 1, Math.Min(Q, N)); j < N; j++)
                {
                    g[j] += nextG[j];
                    nextG[j] = 0;
                }
            }

            Console.WriteLine(N - fail);
        }
    }
}
