Question: In java consider three strings instr1, instr2 and instr3 having only lowercase alphabets. Identify a string, outstr with the smallest possible length such that when

In java

consider three strings instr1, instr2 and instr3 having only lowercase alphabets. Identify a string, outstr with the smallest possible length such that when strings instr1, outstr and instr2 are concatenated in the same order, instr3 becomes a substring of the concatenated string. Print the smallest possible length of (instr1 + outsrt + instr2) satisfying the given criteria.

The string outstr can also be an empty string

Input format

The first, second and third line contain strings insrt1,instr2 and instr3 respectivley

Read the input from the standard input stream.

Output format

Print the smallest possible length of (instr1 + outstr + instr2) satisfying the given criteria.

Print the output to the standard output stream.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!