import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param A string字符串 
     * @param B string字符串 
     * @return string字符串
     */
    public String binaryAdd (String A, String B) {
        // write code here
        
        int ml = Math.max(A.length(), B.length());
        while (ml != A.length()) {
            A = "0" + A;
        }
        while (ml != B.length()) {
            B = "0" + B;
        }
        int carryBit = 0;
        StringBuffer res = new StringBuffer("");
        for (int i = ml - 1; i > -1; i--) {
            int tmp = Integer.valueOf(A.charAt(i) + "") + Integer.valueOf(B.charAt(i) + "") + carryBit;
            res.append(tmp % 2);
            carryBit = tmp / 2;
        }
        if (carryBit == 1) {
            res.append(carryBit);
        }
        res.reverse();
        return new String(res);
    }
}