Problem 4: Anagram again
An anagram is a word or phrase formed by reordering the letters of another word or phrase.
In this problem you are given a word consists of 1 to 10 characters (no spaces), and your program should rearrange characters of the given word and display all possible distinct anagrams, and finally display the number of possible distinct anagrams. The order of anagrams in the output is not important.
Sample Input:
C++/Java
Visual Basic
ABC "ABC"
Sample output:
ABC
ACB
BAC
BCA
CAB
CBA
6 anagrams
|