You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
Given a string, find out the lexicographically smallest and largest substring of length k.
[Note: Lexicographic order is also known as alphabetic order dictionary order. So "ball" is smaller than "cat", "dog" is smaller than "dorm". Capital letter always comes before smaller letter, so "Happy" is smaller than "happy" and "Zoo" is smaller than "ball".]
Input Format
First line will consist a string containing english alphabets which has at most 1000 characters. 2nd line will consist an integer k.
Output Format
In the first line print the lexicographically minimum substring. In the second line print the lexicographically maximum substring.