Write a Java program using recursion that will display, one per line, all possib
ID: 3641052 • Letter: W
Question
Write a Java program using recursion that will display, one per line, all possible scramblings of a word that is given on the command line. If there is no word or more than one word on the command line then the program should produce no output.Running the program as:
> java Scramble abc
should generate this output:
abc
acb
bac
bca
cab
cba
Running as:
> java Scramble abcd
should generate this output:
abcd
abdc
acbd
acdb
adbc
adcb
bacd
badc
bcad
bcda
bdac
bdca
cabd
cadb
cbad
cbda
cdab
cdba
dabc
dacb
dbac
dbca
dcab
dcba
And so on.