Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 362 Bytes

File metadata and controls

17 lines (14 loc) · 362 Bytes

Generate all permutations of a string

Given a string with all distinct characters, the task is to generate all permutations of the string. For a n-letter string, there should be n! strings as output. For repeating characters, there are corresponding duplicates.

An example of the program: Input: abc

Output:

  1. abc
  2. acb
  3. bac
  4. bca
  5. cba
  6. cab