Https://www.codechef.com/viewsolution/39026936

https://www.codechef.com/viewsolution/39026936
Can anyone explain yesterday cook off substring solution

Given a string C u had to find two string A and B suchg that B is substring of A
eg-- S=abcdb
lets take string C as abcdb for given string u had to find 2 string which satisfies above condition for that
Take pen and paper and try different possibilities u will find that
S is composed of
abcd+b
so take A=abcd and B=b and B is substring of A as A[3]=B[0]
so conclusion is always take last character of that string B and check in string A of length n-1 whether B occur if yes that output yes else no
Code:
https://www.codechef.com/viewsolution/38999997

got it thank u

1 Like