题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
#include <stdio.h>
int main() {
int a, b;
char str[105];
scanf("%s",str);
for(int i=0;str[i]!='\0';i++){
if(str[i]>='0'&&str[i]<='9'){
printf("%c",str[i]);
}
else if(str[i]>='a'&&str[i]<='c'){
printf("2");
}
else if(str[i]>='d'&&str[i]<='f'){
printf("3");
}
else if(str[i]>='g'&&str[i]<='i'){
printf("4");
}
else if(str[i]>='j'&&str[i]<='l'){
printf("5");
}
else if(str[i]>='m'&&str[i]<='o'){
printf("6");
}
else if(str[i]>='p'&&str[i]<='s'){
printf("7");
}
else if(str[i]>='t'&&str[i]<='v'){
printf("8");
}
else if(str[i]>='w'&&str[i]<='z'){
printf("9");
}
else if(str[i]=='Z'){
printf("a");
}
else{
printf("%c",str[i]-'A'+'a'+1);
}
}
return 0;
}

