C++/C/Java: Anagrams - from original string to target;
I'm trying to solve this problem : http://uva.onlinejudge.org/external/7/732.html . For the given example, they give us the original word, for example TRIT and the target "anagramed" string, TIRT . Objective: We have to output all the valid sequences of 'i' and 'o' (push and pop's, respectively) which produce the target string from the source string. So, I was thinking of calculate all permutations of "i" and "o" , but cutting this cases: 1) if current permutation begins with an 'o', stop checking, since all the of the next permutations will begin with this pop command and popping something