using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        List<int> matrix;

        public void Solve()
        {
            var items1 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var N = items1[0];
            var Q = items1[1];
            var s = Console.ReadLine().ToCharArray().ToList();

            this.matrix = Enumerable.Repeat<int>(1, N).ToList();
            for (int i = 0; i < Q; i++)
            {
                var items2 = Console.ReadLine().Split();
                var t = items2[0][0];
                var d = items2[1][0];

                List<int> indexList = this.GetIndexList(s, t);
                this.Move(indexList, d);
            }

            int answer = this.matrix.Sum();
            Console.WriteLine(answer.ToString());
        }

        private void Move(List<int> indexList, char direction)
        {
            foreach (var index in indexList)
            {
                int targetIndex = direction == 'L' ? index - 1 : index + 1;
                if (this.matrix[index] > 0)
                {
                    // ゴーレムが居る
                    if (targetIndex >= 0 &&
                        targetIndex < this.matrix.Count())
                    {
                        // 移動
                        this.matrix[targetIndex] += this.matrix[index];
                        this.matrix[index] = 0;
                    }
                    else
                    {
                        // 消滅
                        this.matrix[index] = 0;
                    }
                }
            }
        }
        private List<int> GetIndexList(List<char> list, char serachCharactor)
        {
            List<int> indexList = new List<int>();
            for (var index = 0; index < list.Count; index++)
            {
                if (list[index] == serachCharactor)
                {
                    indexList.Add(index);
                }
            }

            return indexList;
        }
    }
}
