Tuesday, July 28, 2015

146 - ID Codes

#include<bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    while(cin >> s)
    {
        if(s == "#")
            break;
        if(next_permutation(s.begin(),s.end()))
            cout << s << endl;
        else
            cout << "No Successor" << endl;
    }
    return 0;
}

No comments:

Post a Comment

Triathlon

Triathlon - CodeChef # include < bits/stdc++.h > using namespace std ; # define fi first # define se second # define mp ...