2419: permutation(重复元素)

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:11 Solved:0

Description

给定需要排列的元素。但其中部分元素可能相同。给出所有不同排列。

Input

1n1≤n≤500
第2行,n个元素。

Output

输出所有不同排列
最后1行输出排列总数。

Sample Input Copy

4
    aacc

Sample Output Copy

aacc
acac
acca
caac
caca
ccaa
6

Source/Category