public static String Hirschberg(int m, int n, String A, String B) {
		String result = "";
		if (n == 0 || m == 0)
			return result;
		if (m == 1) {
			char zero_index = A.charAt(0);
			for (int i = 0; i < n; i++) {
				if (zero_index == B.charAt(i)) {
					result = String.valueOf(zero_index);
					break;
				}
			}
			return result;
		}
		int i = 0, k = 0, MaxArg = 0, sum = 0, MidA = m / 2;
		int[] l = LastNWLine(MidA, n, A.substring(0, MidA), B);
		int[] r = LastNWLine(m - MidA, n, new StringBuffer(A.substring(MidA)).reverse().toString(), new StringBuffer(B).reverse().toString());
		for (i = 0; i <= n; i++) {
			sum = l[i] + r[n - i];
			if (sum > MaxArg) {
				MaxArg = sum;
				k = i;
			}
		}
		result = Hirschberg(MidA, k, A.substring(0, MidA), B.substring(0, k)) + Hirschberg(m - MidA, n - k, A.substring(MidA), B.substring(k));
		return result;
	}