import           Control.Exception (assert)
import           Control.Monad     (replicateM)
import           Data.List         (foldl')

main :: IO ()
main = do
  [n, q] <- map read . words <$> getLine
  s <- getLine
  assert (length s == n) $ do
    spells <- replicateM q $ do
      [t, d] <- words <$> getLine
      pure $ toSpell t d
    print $ solve n s spells

data Spell = Spell Char Direction

data Direction = L | R

toSpell :: String -> String -> Spell
toSpell [c] "L" = Spell c L
toSpell [c] "R" = Spell c R
toSpell _   _   = error "irregular"

solve :: Int -> String -> [Spell] -> Int
solve n s spells =
  let
    l = bisect (\i -> destination s spells i == LeftEdge) 0 n
    r = bisect (\i -> destination s spells i /= RightEdge) 0 n
  in
    r - l

bisect :: (Int -> Bool) -> Int -> Int -> Int
bisect p lowerB upperB -- section: [lowerB, upperB)
  | upperB - lowerB == 1 = lowerB
  | p middle             = bisect p middle upperB
  | otherwise            = bisect p lowerB middle
  where
    middle = (lowerB + upperB) `div` 2

data WithEdge a = LeftEdge | Inner a | RightEdge
  deriving (Eq)

destination :: String -> [Spell] -> Int -> WithEdge Char
destination s spells i = extract $ foldl' update zipper spells
  where
    zipper = nTimes (i + 1) right $ fromList $ [LeftEdge] ++ map Inner s ++ [RightEdge]

    update z (Spell c d) =
      case (extract z == Inner c, d) of
        (False, _) -> z
        (True, L)  -> left z
        (True, R)  -> right z

fromList :: [a] -> Zipper a
fromList []       = error "non empty"
fromList (x : xs) = Zipper [] x xs

nTimes :: Int -> (a -> a) -> a -> a
nTimes n f x = iterate f x !! n

data Zipper a = Zipper [a] a [a]

extract :: Zipper a -> a
extract (Zipper _ x _) = x

left :: Zipper a -> Zipper a
left z@(Zipper [] _ _)      = z
left (Zipper (l : ls) x rs) = Zipper ls l (x : rs)

right :: Zipper a -> Zipper a
right z@(Zipper _ _ [])      = z
right (Zipper ls x (r : rs)) = Zipper (x : ls) r rs
