Favourite footballer
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 1.0 s
Memory Limit: 128.0 MB
Description
Alice got a string S as a gift of new year from his friend Bob. As Alice is so much addicted in football so he was trying to figure out if there has a subsequence in the string S same as his favourite footballers name.
A string SS whill be called a subsequence of string S if it is possible to obtain the string SS by deleting some (possibly zero) characters from S.
for example: alice is a subsequence of uaeloicdoet, if we delete the characters of position \(1,3,5,8,9,11\) the remaining characters are alice
Note: you can not rearrange the string or the subsequence
As a programmer friend of alice can you write a program that can find the answer of this problem?
Input
first line of input consist an integer T: the number of testcases
each test case consists two string of lower case latin letters : S,N: the string alice got and the name of his favourite player.
\(1 <= T <= 100\)
\(2 <= |N| < |S| <= 1000\)
Output
Output T lines, each line should print a string YES if there is a valid subsequence in the string S or NO otherwise.
Sample
Input | Output |
---|---|
|
|
in the first testcase the subsequence is shown by uppercase letters: aaMaESeSmI
in the second and third testcase there has no valid subsequence which can make the string "ronaldo"
Brain booster - 1
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 10
- Start at
- 2023-12-31 13:15
- End at
- 2023-12-31 17:15
- Duration
- 4.0 hour(s)
- Host
- Partic.
- 36