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

namespace Test03
{
    class Program
    {
        static void Main(string[] args)
        {
            var tmp = Console.ReadLine().Split(' ');

            var N = int.Parse(tmp[0]);
            var Q = int.Parse(tmp[1]);

            var s = Console.ReadLine();
            var g = new int[N];
            for (int i = 0; i < N; i++) { g[i] = 1; }

            //----------------------------------------
            for (int i = 0; i < Q; i++)
            {
                var mv = Console.ReadLine().Split(' ');

                for (int j = 0; j < N; j++)
                {
                    if (s[j].ToString() == mv[0])
                    {
                        if (mv[1] == "L")
                        {
                            if (j > 0) { g[j - 1] += g[j]; }
                        }
                        else
                        {
                            if (j < N - 1) { g[j + 1] += g[j]; }
                        }
                        g[j] = 0;
                    }
                }
            }

            var G = 0;
            for (int i = 0; i < N; i++)
            {
                G += g[i];
            }

            Console.WriteLine(G);
        }
    }
}
