#include <iostream>
#include <cstring>
using namespace std;
int LCS(string x, string y , int n , int m)
{
int t[n+1][m+1];
for(int i=0;i<=n+1;i++)
for(int j=0;j<=m+1;j++)
{
if(i==0 || j==0)
t[i][j]=0;
}
for(int i=1;i<=n+1;i++)
for(int j=1;j<=m+1;j++)
{
if(x[i-1]==y[j-1])
t[i][j]=1+t[i-1][j-1];
else
t[i][j]=max(t[i-1][j],t[i][j-1]);
}
return t[n][m];
}
int main()
{
string x;
string y;
cin>>x>>y;
LCS(x,y,x.length(),y.length());
return 0;
}
o/p=Process returned 0 (0x0) execution time : 3.342 s Press any key to continue.
the o/p to the following code is always zero . idk why. plzz help . what wrong am I doing ?