195 - Anagram

This problem asks you to generate permutation of letters in alphabetically ascending order.

To solve this, you may use the next_permutation function of the C++ standard library, or write your permutation generator function. A pitfall of this problem is that the alphabetical order is not the same as the ASCII code order. In ASCII code we have

A < B < … < Z < a < b < … < z.

But the problem clearly states that the alphabetical order is

A < a < B < b < … < Z < z.

A reference solution is here.

Creative Commons License
This blog by Che-Liang Chiou is licensed under a Creative Commons Attribution 4.0 International License.