Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions