Join Regular Classroom : Visit ClassroomTech

Question 1 Coding Solution | Permutation Problem | Codewindow.in

Question:

Write a program to input string and display count of all permutation of string without using any built in functions

Input: ABC
Output: 6

Solution:

#codewindow.in
#permutation code
def factorial(n):
    fact=1
    for i in range(1,n+1):
        fact = fact * i
    return fact


s = input()
x=len(s)
y=(x-len(set(s)))*2
print (int(factorial(x)/factorial(y)))

#end

proof:

Follow us

Also Checkout