406179: GYM102302 D Guessing Messages

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Guessing Messagestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

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.

Input

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

Output YES if Roppa's guess is hidden in Samuelo's message. Otherwise, output NO.

ExamplesInput
threeyellowfurryfiends
hellofriend
Output
YES
Input
hardcontest
easyac
Output
NO

Source/Category

加入题单

算法标签: