using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var nq = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var n = nq[0];
        var q = nq[1];
        var s = Console.ReadLine().Trim();
        var qs = new Tuple<int, char>[q];
        for (int i = 0; i < qs.Length; i++)
        {
            var td = Console.ReadLine().Split().ToArray();
            qs[i] = Tuple.Create(td[0][0] - 'A', td[1][0]);
        }

        var cells = E.Repeat(0, 26).Select(x => new List<int>(s.Length)).ToArray();
        for (int i = 0; i < s.Length; i++)
        {
            cells[s[i] - 'A'].Add(i);
        }

        var golems = E.Repeat(1, s.Length).ToArray();
        var offsets = new int[26];
        var numAlive = s.Length;
        for (int i = 0; i < qs.Length; i++)
        {
            var t = qs[i].Item1;
            var d = qs[i].Item2 == 'R' ? 1 : -1;
            
            var k = cells[t].Count;
            foreach (var p in cells[t])
            {
                if (p + d < 0 || p + d >= s.Length)
                {
                    numAlive -= golems[p];
                    golems[p] = 0;
                    continue;
                }
                
                golems[p + d] += golems[p];
                golems[p] = 0;
            }
        }

        Console.WriteLine(numAlive);
    }
}
