Longest Common Subsequence

https://ide.codingblocks.com/#/s/24405
https://hack.codingblocks.com/contests/c/457/1267

Finding lcs of A and B and then finding its lcs will C wont be the optimal approach. It might be possible that we have LCS(A,B) of size say 10 and it has no character common in C, but if we pick a string of length 5 which is present in A,B,C it would help.

Try this example
1
abcdefghij ghijabcdef ghij
Expected
4 (ghij)
Your output
1

Here is my solution for reference:
https://ide.codingblocks.com/#/s/24430