package dll.热身赛; import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { HashMapmap = new HashMap<>(); add(map); Scanner sc = new Scanner(System.in); String[] arr = sc.nextLine().split(" "); String[] brr = new String[arr.length]; String temapStr; for (int i = 0; i < arr.length; i++) { temapStr = ""; if (arr[i].length() == 1) { temapStr = arr[i] + arr[i]; brr[i] = temapStr; } else if (arr[i].length() == 2) { brr[i] = arr[i]; } else if (arr[i].length() == 3) { if (arr[i].equals("ang") || arr[i].equals("eng") || arr[i].equals("ing") || arr[i].equals("ong")) { temapStr = arr[i].charAt(0) + map.get(arr[i]); brr[i] = temapStr; } else { String st = arr[i].substring(0, 2); if (map.containsKey(st)) { temapStr = map.get(st) + arr[i].charAt(2); brr[i] = temapStr; } else { temapStr = arr[i].charAt(0) + map.get(arr[i].substring(1)); brr[i] = temapStr; } } } else { String st = arr[i].substring(0, 2); if (map.containsKey(st)) { temapStr = map.get(st) + map.get(arr[i].substring(2)); brr[i] = temapStr; } else { temapStr = arr[i].charAt(0) + map.get(arr[i].substring(1)); brr[i] = temapStr; } } } String si = ""; for (int i = 0; i < brr.length - 1; i++) { si += (brr[i] + " "); } si += brr[brr.length - 1]; System.out.println(si); } public static void add(HashMap map) { map.put("iu", "q"); map.put("ei", "w"); map.put("uan", "r"); map.put("ue", "t"); map.put("un", "y"); map.put("sh", "u"); map.put("ch", "i"); map.put("uo", "o"); map.put("ie", "p"); map.put("ong", "s"); map.put("iong", "s"); map.put("ai", "d"); map.put("en", "f"); map.put("eng", "g"); map.put("ang", "h"); map.put("an", "j"); map.put("uai", "k"); map.put("ing", "k"); map.put("uang", "l"); map.put("iang", "l"); map.put("ou", "z"); map.put("ia", "x"); map.put("ua", "x"); map.put("ao", "c"); map.put("zh", "v"); map.put("ui", "v"); map.put("in", "b"); map.put("iao", "n"); map.put("ian", "m"); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)