题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); char[] chars = new char[s.length()]; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if(c>='A'&&c<'Z'){ chars[i]= (char) (c+33); }else if (c=='Z'){ chars[i]='a'; }else if(c>='a'&&c<='c'){ chars[i]='2'; }else if (c>='d'&&c<='f'){ chars[i]='3'; }else if (c>='g'&&c<='i'){ chars[i]='4'; }else if (c>='j'&&c<='l'){ chars[i]='5'; }else if (c>='m'&&c<='o'){ chars[i]='6'; }else if (c>='p'&&c<='s'){ chars[i]='7'; }else if (c>='t'&&c<='v'){ chars[i]='8'; }else if (c>='w'&&c<='z'){ chars[i]='9'; }else { chars[i]=c; } } for (int i = 0; i < chars.length; i++) { System.out.print(chars[i]); } } }#我的实习求职记录#