|
Problem # 4 : The Hell problem
Write a sub-routine PERMUTATIONS(A$) which will print all unique permutations of the characters of the string A$ alongwith the number of permutations on a cleared screen.
Assume that A$ is no longer than 10 characters and that the string A$ consists of only one word.
Sample Output
PERMUTATIONS("ABC") should give :
ABC
ABC BAC BCA CAB CBA
Total = 6
PERMUTATIONS("HELL") should give :
HELL HLEL HLLE EHLL ELHL ELLH LHEL
LHLE LEHL LELH LLHE LLEH
Total = 12
PERMUTATIONS("AAAAA") should give :
AAAAA
Total = 1
PERMUTATIONS("AAAAB") should give :
AAAAB AAABA AABAA ABAAA BAAAA
TOTAL = 5
|