poj 1146(水题)

#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
    char data[55];
    while(scanf("%s",data)==1&&strcmp(data,"#")){
        if(next_permutation(data,data+strlen(data))){
            printf("%s\n",data);
        }
        else{
            printf("No Successor\n");
        }
    }
    return 0;
}

 

posted @ 2021-12-05 21:45  智人心  阅读(24)  评论(0)    收藏  举报