Smallest Character Window

Python Medium 4 views
Back to Questions

Problem Description

A string s is provided and integer k. Output the lexicographically smallest substring of length k. If k>len(s), output EMPTY.

Input Format

Line1: s. Line2: k.

Output Format

One substring or EMPTY.

Sample Test Case

Input:
cabaa 3
Output:
aab

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next