LogiQuest

417. Permutation in String

MediumSliding Window

Print YES if some substring of s2 is a permutation of s1, else NO.

Input format

Line 1: s1 Line 2: s2

Output format

YES or NO

Example 1

Input

ab
eidbaooo

Output

YES

Example 2

Input

ab
eidboaoo

Output

NO

Constraints

1 ≤ |s1|, |s2| ≤ 10⁴

Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.

Loading the MyLoginn IDE…