$25
You are required to construct a program that will perform the following sequence of operations:
(a) Reads a string and an integer, N, where the value of N is no larger than the number of characters in the string. (You may assume that the characters in the string are not repeated)
(b) Generate and output all possible N-character permutations of the characters in the string.
(c)
Store the generated permutations, as they are calculated, in a 2-4 tree. Print the inorder traversal of the tree.
E.g.
Input AbdDC 2
Output
Ab, Ad, AD, AC, bA, bd, bD, bC, dA, db, dD, dC, DA, Db, Dd, DC, CA, Cb, Cd, CD