400377: GYM100155 C Encrypted Password

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

Description

C. Encrypted Passwordtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Encrypting passwords is one of the most important problems nowadays, and you trust only the encryption algorithms which you invented, and you have just made a new encryption algorithm.

Given a password which consists of only lower case English letters, your algorithm encrypts this password using the following 3 steps (in this given order):

  1. Swap two different characters of the given password (you can do this step zero or more times).
  2. Append zero or more lower case English letters at the beginning of the output of step one.
  3. Append zero or more lower case English letters to the end of the output of step two.

And the encrypted password is the output of step three.

You have just finished implementing the above algorithm and applied it on many passwords. Now you want to make sure that there are no bugs in your implementation, so you decided to write another program which validates the output of the encryption program. Given the encrypted password and the original password, your job is to check whether the encrypted password may be the result of applying your algorithm on the original password or not.

Input

The input consists of two lines. The first line contains the encrypted password. The second line contains the original password. Both the encrypted password and the original password are at least 1 and at most 100,000 lower case English letters (from 'a' to 'z'), and the length of the original password is less than or equal the length of the encrypted password.

Output

Print on a single line one word, "YES" (without the quotes) if applying the algorithm on the original password may generate the encrypted password, otherwise print "NO" (without the quotes).

ExamplesInput
abcdef
ecd
Output
YES
Input
cde
ecd
Output
YES
Input
abcdef
fcd
Output
NO

加入题单

上一题 下一题 算法标签: