主要利用了a ASCII值上一个是 ‘`’
#include<bits/stdc++.h>
using namespace std;
string p,sub,upsub;
int n,l,r,sz;
int main(){
cin>>p>>n;
for(int i=0;i<n;i++)
{
cin>>l>>r;
sub=p.substr(l-1,r-l+1) , sz=r-l+1;
upsub="a"+sub;
upsub[sz]-=1;
for(int j=sz;j>=1;j--)
{
if(upsub[j]=='`')
upsub[j-1]--,upsub[j]='z';
}
if(upsub[0]=='`')
cout<<"NULL\nHappy Chinese New Year!\n";
else
{
string fi=upsub.substr(1,sz);
cout<<fi<<"\n";
int s=(int)p.find(fi);
if(s==-1)
cout<<"Happy Chinese New Year!\n";
else
cout<<"Happy New Year!\n";
}
}
return 0;
}
```cpp