Permutation with Spaces
Easy

Problem Statement

Given a string, print all permutations of the string by putting spaces between characters. The first character remains fixed.

Examples

1Example 1
Input:
{ "s": "ABC" }
Output:
[ "A B C", "A BC", "AB C", "ABC" ]
2Example 2
Input:
{ "s": "AB" }
Output:
[ "A B", "AB" ]
3Example 3
Input:
{ "s": "A" }
Output:
[ "A" ]
Loading...

Sign in to Run Code and Submit