Permutations of a string

in the video i am not able to understand the recursive case,how this loop will take care of all permutations to be called,pls explain with e.g


Read this article and dry run on N=3 having S=“ABC” or N=“4” and S=“ABCD”