Codey and Manuscript
https://www.hackerrank.com/contests/codenection-2024-preliminary-round-open-category/challenges/cn24-7/problem
Last updated
https://www.hackerrank.com/contests/codenection-2024-preliminary-round-open-category/challenges/cn24-7/problem
Last updated
Codey, a scholar from the kingdom of CodeNection, has been given an important mission by Queen Zoey. Queen Zoey recently uncovered an ancient manuscript that holds a string s
, believed to contain a hidden message about the future king of the kingdom. However, parts of the manuscript are missing, with these gaps marked by *
where letters once were.
To help restore the message, Queen Zoey gives Codey another string v
, which is known to be part of the hidden message. Codey’s task is to determine whether it is possible to fill the gaps in s
with lowercase English letters such that v
appears as a subsequence of the s
.
Codey must report back to Queen Zoey about his progress.
A string b
is subsequence of string a
if it's possible to remove some character in a
to get b
(without changing the order).
The first line contains a single integer t
, where t
represents the number of test cases.
The first line of each test case contains a single string s
, where s
represents the damaged manuscript. It contains lowercase English letters and *
.
The second line of each test case contains a single string v
, where v
represents the hidden message that must appear as a subsequence in the completed manuscript.
For each test case, if it’s possible to fulfill the conditions, output YES
. Otherwise, output NO
.
It is guaranteed that the sum of across all test cases doesn't exceed .