CodeLab Academy 📞 9936 6696
← List Python · Level 9: Functions and dicts Code · 90 points ← #826 #828 →

#827. Permutations

You get a short word whose letters are all different. Print all its permutations in alphabetical order, one per line. ### Input One word (1-4 letters). ### Output Answer.

Examples

Input
xd
Output
dx
xd
Input
dxcb
Output
bcdx
bcxd
bdcx
bdxc
bxcd
bxdc
cbdx
cbxd
cdbx
cdxb
cxbd
cxdb
dbcx
dbxc
dcbx
dcxb
dxbc
dxcb
xbcd
xbdc
xcbd
xcdb
xdbc
xdcb

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!