import java.util.Scanner;
public class Test {
// 共享成员变量,矩阵
public static int[][] arr = null;
// 主函数
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
String str1 = scanner.nextLine();
String str2 = scanner.nextLine();
// System.err.println(str1 + " " + str2);
int x = trans(str1) + trans(str2);
// System.out.println(x);
System.out.println(tranString(x));
}
// System.out.println(trans("b"));
}
public static int trans(String str) {
int count = 0;
for (int i = str.length() - 1, j = 1; i >= 0; i--, j *= 26){
char c = str.charAt(i);
if (c < 'a' || c > 'z') return 0;
count += ((int)c - 'a') * j;
}
return count;
}
public static String tranString(int n) {
String s = "";
while (n > 0){
int m = n % 26;
s = (char)(m + 'a') + s;
n = (n - m) / 26;
}
return s;
}
}
十进制与26进制转换(Java)
猜你喜欢
转载自blog.csdn.net/andanwubian/article/details/82558862
今日推荐
周排行