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 sl = s.length()-1, tl = t.length()-1;
int temp = 0;
StringBuilder sb = new StringBuilder();
while(sl>=0||tl>=0||temp!=0){
temp += (sl>=0)?s.charAt(sl--)-'0':0;
temp += (tl>=0)?t.charAt(tl--)-'0':0;
sb.append(temp%10);//方法一
// sb.insert(0, temp%10);//方法二,耗时更久,因为n^2复杂度的数组移动。
temp /= 10;
}
return sb.reverse().toString();
// return sb.toString();
}
}