解题思路:
import java.util.Scanner; public class C1214 { private static final String pwd = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final String word = "VWXYZABCDEFGHIJKLMNOPQRSTU"; public static void main(String[] args) { StringBuffer sb = new StringBuffer(); Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String str = sc.nextLine(); if("ENDOFINPUT".equals(str)) break; if("START".equals(str) || "END".equals(str)) continue; char[] chs = str.toCharArray(); for(char ch : chs){ if(ch >= 'A' && ch <= 'Z') ch = word.charAt(pwd.indexOf(ch)); sb.append(ch); } sb.append("\n"); } System.out.println(sb); sc.close(); } }
注意事项:
参考代码:
0.0分
0 人评分