import java.util.*;
public class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
* 计算两个数之和
* @param s string字符串 表示第一个整数
* @param t string字符串 表示第二个整数
* @return string字符串
*/
public String solve (String s, String t) {
// write code here
int len1 = s.length();
int len2 = t.length();
if(len1 == 0){
return t;
}
if(len2 == 0){
return s;
}
int maxLength = Math.max(len2,len1);
int curIndex = 0;
boolean isNeedAdd = false;
StringBuilder sb = new StringBuilder();
while(curIndex < maxLength){
int n1 = 0;
if(curIndex < len1){
n1 = Integer.valueOf(s.substring(len1 - 1 - curIndex,len1 - curIndex));
}
int n2 = 0;
if(curIndex < len2){
n2 = Integer.valueOf(t.substring(len2 - 1 - curIndex,len2 - curIndex));
}
curIndex ++;
int count = n1 + n2;
if(isNeedAdd){
count += 1;
}
if(count >= 10){
isNeedAdd = true;
sb.insert(0,count % 10);
} else {
isNeedAdd = false;
sb.insert(0,count);
}
}
if(isNeedAdd){
sb.insert(0,1);
}
return sb.toString();
}
}