Word Scrambler

View as PDF

Submit solution

Points: 7
Time limit: 0.6s
Memory limit: 32M

Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Looking to find some clever anagrams, you want a helper tool that will list all possible arrangements of letters for a given source word. To make the list easier to scan, the output should be in ascending sorted order.

Input Specification

The input will consist of one string of lower-case alphabet characters, at least 1 character long, and no more than 5.

Output Specification

The output should contain all the possible combinations of letters in the word, sorted alphabetically.

To make things easier, all of the letters in each word are guaranteed to be unique (so then every combination will also be unique).

Note: since there are n! possibilities for combinations of n letters, you can use that fact to check that you have the right number of possibilities in your output.

Sample Input


Sample Output



There are no comments at the moment.