#include <stdio.h> #include <algorithm> using namespace std; int main () { char A [100], Len; while (scanf ("%s", A )) { if ( A [0] == '#' ) break; Len = strlen (A); if (next_permutation (A, A + Len) ) printf("%s\n", A); else printf("No Successor\n"); } return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)