New update is available. Click here to update.

Letter Case Permutation

Posted: 11 Mar, 2021
Difficulty: Moderate

PROBLEM STATEMENT

Try Problem

You are given a string 'S'. Your task is to find an array of all possible strings in any order that can be formed by transforming every letter individually to the lowercase or the uppercase.

Note:

1. You can print the array in any order.

2. The string 'S' only contains English alphabets and digits.
Input Format:
The first line contains an integer T, which denotes the number of test cases or queries to be run. Then, the T test cases follow. 

The first and only line of each test case contains a string 'S', as described in the problem statement.
Output Format:
For each test case, print a single line containing space-separated strings denoting all possible strings by transforming, as described in the problem statement.

The output for each test case will be printed in a separate line.
Note:
You do not need to print anything. It has already been taken care of. Just implement the given function.
Constraints:
1 <= T <= 100
1 <= |S| <= 12

Where |S| denotes the length of string 'S'.

Time Limit: 1 sec.