Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- static int factorial(int n){
- int fact = 1;
- while(n>1) fact *= n--;
- return fact;
- }
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String str = sc.next();
- int i, length = str.length();
- int[] a = new int[26];
- for(i = 0; i < length; i++) a[str.charAt(i)-97]++; // 'a'=97
- int den = 1;
- for(i = 0; i < 26; i++) den *= factorial(a[i]);
- System.out.println(factorial(length)/den);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement