LearnPy Hub
← Arena
AdvancedRating 1800

Smallest Window

Print the shortest substring of s that contains every character of t (with multiplicity). If several, the leftmost. Print -1 if none.

Input

Two lines: s, then t.

Output

A substring or -1.

Sample 1

Input
ADOBECODEBANC
ABC
Output
BANC

Sample 2

Input
a
a
Output
a
solution.py
Output appears here
Smallest Window · Python Arena problem · LearnPy Hub