Print Permutations - String Problem Statement

Given an input string 'S', you are tasked with finding and returning all possible permutations of the input string.

Input:

The first and only line of input contains a string 'S' of alphabets in lower case characters.

Output:

Print all the permutations of the given string 'S' on separate lines.

Example:

Input: "abc"
Output:
abc
acb
bac
bca
cab
cba

Constraints:

  • 0 <= |S| <= 8

Note:

  • The input string may contain the same characters, so there can be duplicate permutations.
  • The order of permutations does not matter.
  • You do not need to print anything; it has already been taken care of. Implement the function to return the answer.

Be the first one to answer
Add answer anonymously...
Accenture Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter