An effective method to tackle this problem is through recursion. Below is a solution implemented in Python: def permute ( data , start , end ) : if start == end : print ( '' . join ( data ) ) else : for i in range ( start , end ) : data [ start ] , data [ i ] = data [ i ] , data [ start ] permute ( data , start + 1 , end ) data [ start ] , data [ i ] = data [ i ], data [ start ] # backtrack string = 'ABC' n = len ( string ) data = list ( string ) permute ( data , 0 , n ) In this implementation, we swap each character with the starting character and then recursively call the function on the remaining characters. Once we have all permutations, we backtrack to prevent duplicates in the order of the results.