private int lengthLCS(String X, String Y, int m, int n)
	{

		if (l[m][n] != Integer.MIN_VALUE)
			return l[m][n];

		if (X.charAt(m) == Y.charAt(n))
		{
			l[m][n] = lengthLCS(X, Y, m - 1, n - 1) + 1;
			lcs[m][n] += lcs[m - 1][n - 1] + X.charAt(m);
		}
		else
		{
			int l1 = lengthLCS(X, Y, m - 1, n);
			int l2 = lengthLCS(X, Y, m, n - 1);
			if (l1 > l2)
			{
				l[m][n] = l1;
				lcs[m][n] += lcs[m - 1][n];
			}
			else
			{
				l[m][n] = l2;
				lcs[m][n] += lcs[m][n - 1];
			}
		}

		if (l[m][n] == Integer.MIN_VALUE)
		{
			System.out.println(m + " " + n);
			System.exit(1);
		}
		return l[m][n];
	}