Given a string S consisting of lower case English alphabets and an integer K.
You need to form a new string P that follows the following conditions:
Task
Determine the string P that satisfies all the given conditions.
Example
Assumptions
Approach
Function Description
Complete the solve function provided in the editor. This function takes the following 3 parameters and returns the valid string:
Input Format
Note: This is the input format you must use to provide custom input (available above the Compile and Test button).
Output Format
For each test case in a separate line, output a string P that satisfies all the given conditions.
Constraints
1≤T≤102≤N≤2∗1052≤K≤2∗105
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.
The first line contains the number of test cases, T = 2.
For Test case 1:
For Test case 2: