#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
string s;
cin>>s;
// 把每个字母对应的值映射下来 方便后序处理
int a[26]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9};
for(int i=0;i<s.size();i++){
if(s[i]>='0'&&s[i]<='9'){
cout<<s[i];
}
else if(s[i]>='a'&&s[i]<='z'){
cout<<a[s[i]-'a'];
}
else{
// 关键再于吧大写字母转化为对应的小写字母
char c= s[i]-'A'+'a';// 大写转化为小写
c=(c-'a'+1)%26+'a'; // 后面一位
cout<<c;
}
}
// 请在此输入您的代码
return 0;
}
活动地址: 牛客春招刷题训练营 - 编程打卡活动

京公网安备 11010502036488号