Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
英小文字のみからなる長さ 3 の文字列 S が与えられます。
S の各文字を並び替えて得られる文字列は、何種類ありますか?
制約
- S は英小文字のみからなる長さ 3 の文字列
入力
入力は以下の形式で標準入力から与えられる。
S
出力
S の各文字を並び替えて得られる文字列の種類数を出力せよ。
入力例 1
aba
出力例 1
3
S= aba
の各文字を並び替えて得られる文字列は、aab
, aba
, baa
の 3 通りです。
入力例 2
ccc
出力例 2
1
S= ccc
の各文字を並び替えて得られる文字列は、ccc
の 1 通りのみです。
入力例 3
xyz
出力例 3
6
S= xyz
の各文字を並び替えて得られる文字列は、xyz
, xzy
, yxz
, yzx
, zxy
, zyx
の 6 通りです。
Score : 100 points
Problem Statement
You are given a string S of length 3 consisting of lowercase English letters.
How many different strings can be obtained by permuting the characters in S?
Constraints
- S is a string S of length 3 consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of different strings that can be obtained by permuting the characters in S.
Sample Input 1
aba
Sample Output 1
3
By permuting the characters in S= aba
, three different strings can be obtained: aab
, aba
, baa
.
Sample Input 2
ccc
Sample Output 2
1
By permuting the characters in S= ccc
, just one string can be obtained: ccc
.
Sample Input 3
xyz
Sample Output 3
6
By permuting the characters in S= xyz
, six different strings can be obtained: xyz
, xzy
, yxz
, yzx
, zxy
, zyx
.