A warehouse tape s is a string of lowercase letters, each letter a stocked item. An order p is a string of lowercase letters listing the items it needs, with multiplicity (so p = "aab" needs two a's and one b). Find the length of the shortest contiguous substring of s that contains at least the required count of every item in p. If no such substring exists, report 0.
Input format
Line 1: the tape string s (lowercase English letters, no spaces).
Line 2: the order string p (lowercase English letters, no spaces).
Output format
A single integer: the length of the shortest window of s covering the multiset p, or 0 if impossible.
Constraints
- 1 ≤ |s| ≤ 100000
- 1 ≤ |p| ≤ 100000
- Both strings consist of lowercase English letters only.