Write a function to generate and return all permutations of a string.
Input:-abc
Input Description: Input a single string.
Output: abc acb bac bca cab cba
Output Description: Output a string containing all permutations separated by spaces.
Constraints: 1 <= string length <= 10^6
Explanation: