#K78312. Minimum Window Substring

    ID: 35059 Type: Default 1000ms 256MiB

Minimum Window Substring

Minimum Window Substring

Given two strings \(s\) and \(t\), find the minimum window substring of \(s\) which contains every character in \(t\) (including duplicates). If there is no such substring, return an empty string.

The solution should use an efficient approach, for example the sliding window technique, to ensure that it runs efficiently even on larger inputs.

Note: Both \(s\) and \(t\) consist of ASCII characters. If either string is empty, the output should be an empty string.

Example:

Input:
ADOBECODEBANC
ABC

Output: BANC

</p>

inputFormat

The input is provided via standard input (stdin) and consists of two lines:

  • The first line contains the string \(s\).
  • The second line contains the string \(t\).

outputFormat

The output should be printed to standard output (stdout) as a single line containing the minimum window substring of \(s\) that contains all characters of \(t\). If no such substring exists, output an empty string.

## sample
ADOBECODEBANC
ABC
BANC