import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String key = sc.nextLine();
String text = sc.nextLine();
HashMap hm = new HashMap();
char[] item = key.toCharArray();
List list = new ArrayList();
for (int i = 0; i < item.length; i++) {
if (!list.contains(item[i])) {
list.add(item[i]);
}
}
for (int k = 65; k < 91; k++) {
char str = (char) (k);
char str1 = (char) (k + 32);
if (!(list.contains(str) || list.contains(str1))) {
list.add(str);
}
}
for (int k = 65; k < 91; k++) {
char str = (char) (k);
hm.put(str, list.get(k - 65));
}
for (int k = 0; k < text.length(); k++) {
char it = text.charAt(k);
String it1 = String.valueOf(it).toUpperCase();
char cc = it1.charAt(0);
if (Character.isUpperCase(it)) {
System.out.print(hm.get(cc).toString().toUpperCase());
} else {
System.out.print(hm.get(cc).toString().toLowerCase());
}
}
}
}
华为测试 字符加密
最新推荐文章于 2023-12-25 19:03:21 发布