summaryrefslogtreecommitdiff
path: root/146/id.cpp
blob: 58698fa06b9cfd7e7ff9e08e0303fab11e6907d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <string.h>
#include <algorithm>

int main(){
    char s[50];
    std::cin>>s;
    while(s[0]!='#'){
	if(std::next_permutation(s, s+strlen(s)))
	   std::cout<<s<<std::endl;
	else
	    std::cout<<"No Successor\n";
	std::cin>>s;
    }
}