


For ‘WORD’ = “abcdefgh”, ‘N’ = 2. Following are the 2 strings of length 4.
“abcd”
“efgh”
The first line of input contains an integer 'T' which denotes the number of test cases or queries to be run. Then the test cases follow.
The first line of each test case contains a string ‘WORD’ and an integer ‘N’.
For each test case, print all strings that can be formed from ‘WORD’ by dividing it into ‘N’ equal parts.
Return empty string array/list if it is not possible to divide ‘WORD’ into ‘N’ equal length strings.
Print the output of each test case in a separate line.
You do not need to print anything; it has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 100
‘WORD’ = Lower case english alphabet
1 <= |WORD| <= 2000
1 <= ‘N’ <= |WORD|
Time Limit: 1 second
First, check if the ‘WORD’ can be divided into ‘N’ strings of equal length or not.
Calculate the possible length ‘len’ of ‘N’ equal length strings.After getting the length, iterate the ‘WORD’ and for each substring of length ‘len’ starting from index 0 print the substring.
Here is the complete Algorithm: