You know those letterboards outside old-style cinemas which show upcoming films - perhaps you have a miniature one in your home?
If you've operated one, you'll know that you can normally add letters from either side of a row. But the slots (in which you slide letters) are thin, so it's impossible to swap the order of two letters once you've put them on.
Thus, you can't just go putting the letters on in any order - there's a restricted set of orders which actually work...
More formally:
Given a string \$ S \$, an ordered list \$ \sigma= (\sigma_i)_{i=0}^k \$ of characters, we will say \$ S \$ is \$\sigma\$-writable if it is possible to write \$ S \$ on a (initially empty) row of a letterboard, by adding (all) the characters from \$ \sigma \$, in order. Characters can be inserted on either side of the row, but can not pass over existing characters.
For example, ABBA is (B,A,B,A)-writable, by the following process:
(empty row)
--> B (insert B from left)
--> AB (insert A from left)
ABB <-- (insert B from right)
ABBA <-- (insert A from right)
But it is not (A,A,B,B)-writable, since after inserting the initial two As, there is no way to put a B in between them.
Trivially, every \$ S \$ is not \$\sigma\$-writable if \$ \sigma \$ is not a permutation of the characters of \$ S \$.
The Challenge
Your task is to write a program which, given a string \$ S \$ of ASCII uppercase letters, and list \$\sigma\$, determines whether \$ S \$ is \$\sigma\$-writable. This is code-golf, so the shortest code wins!
You may assume \$ \sigma \$ has the same length as \$ S \$, although you may not assume it is a permutation of \$ S \$.
Test Cases
In the format \$ S \$, \$ \sigma \$ (as a string).
Truthy inputs:
ORATOR, OTRARO
SEWER, EWSER
COOL, COOL
CHESS, SEHSC
AWAXAYAZ, AXYAWAZA
SERENE, ERENES
Falsy inputs:
SEWER, EWSRE
BOX, BOY
ABACUS, ACABUS
SSSASSS, SSSSASS