Find Common String Challenge
Challenge Description:
Given two strings X
and Y
(same no of characters), what's the longest string ()
that can be created such that it is common in both the strings? String ‘A' is
said to be a child of a string ‘B' if ‘A' can be formed by removing zero or more
characters from ‘B’.
For example, PQRS
and PQSR
has two children with maximum length 3, PQR and PQS.
We will not consider PQRS as a common because R doesn't occur before S in the
second string. So the character order matters.
Evaluation:
Input -> Two strings, x and y, with a newline separating them. All characters in upper case only.
Output -> Print the length of the longest string, such that is a common in both x and y.
Please make sure that your program follows input/output format as prescribed above.