using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nq = Input.ar;
        var str = ReadLine();
        var qur = Enumerable.Repeat(0, nq[1]).Select(v => ReadLine().Split(' ')).ToArray();
        var left = 0;
        var right = nq[0]-1;
        qur = qur.Reverse().ToArray();
        for (var i = 0; i < nq[1]; i++)
        {
            if (qur[i][0][0] == str[left] && qur[i][1][0] == 'L')
                left = Min(left + 1, nq[0] - 1);
            if (qur[i][0][0] == str[right] && qur[i][1][0] == 'R')
                right = Max(right - 1, 0);
        }
        WriteLine(Min(-left + right + 1, nq[0]));
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}
