Special Sub Sequences - Beta
Submissions: 7   Accuracy:

14.29%

  Max. Score:

30

Given a string S, print all ‘Special Sub Sequences’ of SFor Instance, “ab” has the following Special-SubSequences-: { “A”, “AB”, “Ab”, “B”, “a”, “aB”, “ab”, “b” }.

NOTE : Consider only the non-empty special Subsequences of S, as shown above.

Input : The first line of input conains number of testcases TEach testcase contains a single line denoting the string S.

Output : For each testcase you need to print two lines. In the 1st line print N, denoting the number of Special Sub Sequences of S.

In the 2nd line print N space separated integers denoting the Special Sub Sequences of S, in lexicographically increasing order.

Constraints
1 <= T <= 100
1 <= |S| <= 10
The String S, contains only lower-case letters (i.e ‘a’ - ‘z’)

Example :
Input :
1

ab

Output :
8
A AB Ab B a aB ab b

Explanation :
Self Explanatory


to report an issue on this page.