2019 USP-ICMC |
---|
Finished |
Samuelo is a very good friend of Roppa. Whenever they feel bored, they like to exchange secret messages.
To do that, they craft some text in such a way so that the hidden message is a subsequence of it. To make things harder, they never use whitespaces.
An example of message exchanged in the past is (hidden message is red and underlined):
It can be very hard to uncover a message hidden like that, but it's usually not a problem for them since their minds are pretty much in sync.
Samuelo just wrote one of those messages. Roppa decided to take a step further this time and test their friendship by trying to guess the hidden message before even receiving it.
Given the message that Samuelo wrote and Roppa's guess, help Roppa on figuring out if his guess is in fact hidden in Samuelo's message.
The first line the input contains a string $$$s$$$ ($$$1 \leq \lvert s \rvert \leq 10^6$$$), indicating the message that Samuelo wrote. The second line of the input contains a string $$$t$$$ ($$$1 \leq \lvert t \rvert \leq 10^6$$$), indicating Roppa's guess.
Both strings are composed only of lowercase English letters.
Output YES if Roppa's guess is hidden in Samuelo's message. Otherwise, output NO.
threeyellowfurryfiends hellofriend
YES
hardcontest easyac
NO
Name |
---|