Given a string of length n, print all the possible subsets of the string in a lexiographically-sorted order.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains an integer n denoting the length of the string. The second line of each test case contains the string consisting of lower-case english alphabets.
For each testcase, in a new line, print all the possible subsets (except the null subset) in a sorted order with a space between each subset.
1<= T <=100
1<= n <=16
a ab abc ac b bc c
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.