public static void Main()
var X = "Hey This java is hot";
var Y = "Java is a new paradigm";
Console.WriteLine("Length of Longest Common Substring is " + LCSubStr(X, Y, m, n));
static int LCSubStr(string X, string Y, int m, int n)
var LCStuff = new int[m + 1, n + 1];
for (int i = 0; i <= m; i++)
for (int j = 0; j <= n; j++)
else if (X[i - 1] == Y[j - 1])
LCStuff[i, j] = LCStuff[i - 1, j - 1] + 1;
result = Math.Max(result, LCStuff[i, j]);