#include // old io #include #include // tolower inline bool lt_nocase(char c1, char c2) { return tolower(c1) < tolower(c2); } using namespace std; int main() { char A[] = "fdBeACFDbEac"; const int N = sizeof(A) - 1; sort(A, A+N, lt_nocase); // same as stable_sort printf("%s\n", A); // The printed result is ""AaBbCcdDeEfF" because sort is stable. }