Solve it recursively.
For example, your n = 7 case. In the outer layer, you start with {A, B, C, D, E, F, G}. From this, you take one letter out; a different one 7 times. So you have 7 elements in this output array set, each with 6 letters: {A, B, C, D, E, F}, {A, B, C, D, E, G} etc.
For each of these outputs, you then further reduce using the same algorithm. You already know how to deal with {A, B, C, D, E, F}.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…