不会的看我!!!
2023-10-14 10:36:18
发布于:广东
10阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
string s,k;
int len;
int main(){
cin>>k;
len=k.size();
for(int i=0;i<=len-1;i++)
if(k[i]>='a' and k[i]<='z')
k[i]=k[i]-32;
cin>>s;
for(int i=0;i<=s.size()-1;i++){
if(s[i]>='a' and s[i]<='z'){
int x = s[i]-'a';
int y = k[i%len]-'A';
s[i] = (x-y+26)%26+'a';
}
else if(s[i]>='A' and s[i]<='Z'){
int x = s[i]-'A';
int y = k[i%len]-'A';
s[i] = (x-y+26)%26+'A';
}
}
for(int i=0;i<=s.size()-1;++i){
cout<<s[i];
}
return 0;
}
这里空空如也
有帮助,赞一个