https://rainman.blog.luogu.org/solution-p1061
```
//code by rainman
#include<bits/stdc++.h>
using namespace std;
int s,t,w,c;
int a[30],cnt;
inline void output()
{
for(int i=1;i<=w;i++)
cout<<(char)('a'+a[i]-1);
cout<<endl;
}
void dfs(int pos,int step)
{
if(pos==0)return;
if(step==6)return;
if(a[pos]<t&&a[pos]<a[pos+1]-1)
{
a[pos]++;
for(int i=pos+1;i<=w;i++)
a[i]=a[i-1]+1;
output();
dfs(w,step+1);
}
else dfs(pos-1,step);
}
int main()
{
cin>>s>>t>>w;
fflush(stdin);
while((c=getchar())!=EOF)
{
int temp=c-'a'+1;
if(temp>=1&&temp<=26)a[++cnt]=temp;
}
a[w+1]=0x7f;
dfs(w,1);
return 0;
}
```
by xiangling @ 2018-10-13 20:47:54
```cpp
#include<stdio.h>
int main()
{
int s,t,w,i,j,x;
char a[30]={0};
scanf("%d%d%d\n",&s,&t,&w);
gets(a);
for(x=0;x<5;x++)
for(i=w-1;i>=0;--i)
if(a[i]-96<t+i-w+1)
{
a[i]++;
for(j=i+1;j<w;++j)
a[j]=a[j-1]+1;
printf("%s\n",a);
break;
}
return 0;
}
```
by 你打野 @ 2018-10-18 16:51:40
28ms,0.68mb
by 你打野 @ 2018-10-18 16:52:21
一楼抄的题解吧,旁边评论区写着无缩进,本地也过不了的。
——打击抄袭——
by CodeAtlantis @ 2019-06-15 18:27:43
Orz
by lion0514 @ 2020-02-14 19:40:04