Please tell me what i am foing wrong in the longest commen string problem its not printing o/p

You tag this doubt ona different question. Pls give the link of the above problem.

https://hack.codingblocks.com/app/dcb/1359

You are only checking for lexiographically smallest and largest strings. You should check for all strings. Try to solve this problem using binary search.