#include<bits/stdc++.h> using namespace std; int main() { char s[100]; while(cin>>s) { if(s[0] == '#') break; long long l=strlen(s); if(next_permutation(s,s+l)) { cout<<s<<endl; } else cout<<"No Successor"<<endl; } return 0; }
Sunday, April 10, 2016
UVA 146
Labels:
UVA Solution
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)