Monday, August 1, 2016

Published August 01, 2016 by with 0 comment

UVA 146 - ID Codes Solution

#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
    while(1)
    {
        char s[55];
        gets(s);
        if(s[0] == '#')
            break;
        if (!next_permutation(s,s+strlen(s)))
        {
            puts("No Successor");
            continue;
        }
        puts(s);
    }
    return 0;
}
      edit

0 comments:

Post a Comment