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]);  // 1 <= N <= 200000
            var Q = int.Parse(tmp[1]);  // 1 <= Q <= 200000

            // 箱
            var s = Console.ReadLine();
            //ゴーレム 0とN+1は墓場
            var g = new int[N + 2];
            g[0] = 0;
            g[N + 1] = 0;

            var index = new Dictionary<string, List<int>>();
            for (int i = 0; i < N; i++)
            {
                var _s = s[i].ToString();
                if (index.ContainsKey(_s))
                {
                    index[_s].Add(i + 1);
                }
                else
                {
                    index.Add(_s, new List<int>() { i + 1 });
                }

                g[i + 1] = 1;
            }

            // 開始
            for (int i = 0; i < Q; i++)
            {
                //Print(g);

                var pos = Console.ReadLine().Split(' ');

                if (index.ContainsKey(pos[0]))
                {
                    foreach (var idx in index[pos[0]])
                    {
                        if (pos[1] == "L")
                        {
                            g[idx - 1] += g[idx];
                            g[idx] = 0;
                        }
                        else
                        {
                            g[idx + 1] += g[idx];
                            g[idx] = 0;
                        }
                    }
                }
            }
            //Print(g);
            Console.WriteLine(N - (g[0] + g[N - 1]));
        }

        static void Print(int[] _g)
        {
            for (int i = 0; i < _g.Length; i++)
            {
                Console.Write(_g[i]);
            }
            Console.WriteLine();
            Console.WriteLine((_g.Length - 2) - (_g[0] + _g[_g.Length - 1]));
        }
    }
}
