Solution
Let LCS(i,j,k) be the maximum length of a common subsequence of A[1…i],B[1…j], and C[1…k]. Then,
LCS(i,j,k)=max⎩⎨⎧LCS(i−1,j,k)LCS(i,j−1,k)LCS(i,j,k−1)LCS(i−1,j−1,k−1)+1if A[i]=B[j]=C[k]
Base case:
LCS(0,j,k)=LCS(i,0,k)=LCS(i,j,0)=0.
The corresponding algorithm has running time O(nmk).
Code
Here is the code for the algorithm discussed above.