Question: You have two strings, a and b . Find a string, s , such that: substring af b . s is a palindromic sinis .

You have two strings, a and b. Find a string, s, such that: substring af b.
s is a palindromic sinis.
The length of s is as lorg as possible.
For each of the q pairs of strings , and (:b1} fetencd as inpu, find and pent gring A1 on a new lne, if you'te able to form more than one vald string x4 print whichever one comes first aphabetically if there is no valid answer, print -1 rntead.
input Format: aiatry over two lnes:
2 the shesend lire contans a singie waring decoting b
Constraints
1010
*1|a|,|6|11
a ane b contain only bowercace frigithi intien.
Sum of |a| aver al que
res does nec exreed 2=10''
give code in c++
 You have two strings, a and b. Find a string, s,

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!