3 string LCS Dynamic Programming

Sir,i have seen its hint video and i have written as it was but even after compilationmy output is not coming.
it gives 0 in the example input of question.
give some idea to correct it.

if you want then i can send my code

@prince43055kumar yes send the code saved on ide.codingblocks.com

//my code
#include<bits/stdc++.h>

#include

using namespace std;

int lcs3(char x[],char y[],char z[]){

int n,m,p;

n=strlen(x);

m=strlen(y);

p=strlen(z);

int dp[n+1][m+1][p+1]={0};



for(int i=1;i<=n;i++){

    for(int j=1;j<=m;j++){

        for(int k=1;k<=p;k++){

            if(x[i-1]==y[j-1]==z[k-1]){

                  dp[i][j][k]=1+dp[i-1][j-1][k-1];

            }  

            else

            dp[i][j][k]=max(dp[i-1][j][k],max(dp[i][j-1][k],dp[i][j][k-1]));

        }

    }

}

for(int i=0;i<=n;i++){

    for(int j=0;j<=m;j++){

        for(int k=0;k<=p;k++){

            cout<<dp[i][j][k]<<" ";

        }

        

    }

    cout<<endl;

}



return dp[n][m][p];

}

int main() {

char str1[205],str2[205],str3[205];

cin>>str1>>str2>>str2;

int ans=lcs3(str1,str2,str3);

cout<<ans;

return 0;

}

atlast input str3

condition check should be
if(x[i-1]==y[j-1] && x[i-1]==z[k-1])

i have corrected the code but still i’m not getting right output.

#include<bits/stdc++.h>
using namespace std;

int lcs3(char x[],char y[],char z[]){

int n,m,p;

n=strlen(x);

m=strlen(y);

p=strlen(z);

int dp[n+1][m+1][p+1]={0};

for(int i=1;i<=n;i++){

for(int j=1;j<=m;j++){

    for(int k=1;k<=p;k++){

        if(x[i-1]==y[j-1]&& x[i-1]==z[k-1]){

              dp[i][j][k]=1+dp[i-1][j-1][k-1];

        }  

        else

        dp[i][j][k]=max(dp[i-1][j][k],max(dp[i][j-1][k],dp[i][j][k-1]));

    }

}

}

return dp[n][m][p];
}

int main() {

char str1[205],str2[205],str3[205];

cin>>str1>>str2>>str3;

int ans=lcs3(str1,str2,str3);

cout<<ans;

return 0;
}

@prince43055kumar this works fine now

test case 0 is not pasing in submission of problem

@prince43055kumar the code I sent you is passing all tests.