we scramble stre s string t follow algorithmif length string 1 stopif length string 1 followingsplit string nonempty substring random index ie string s divide x y s x yRandomly decide swap substring order ie step s s x y s y xApply step 1 recursively substring x ygiven string s1 s2 length return true s2 scramble string s1 return false Example 1input s1 great s2 rgeatoutput trueExplanation one possible scenario apply s1 isgreat great divide random indexgreat great random decision swap substring ordergreat gr eat apply algorithm recursively substring divide random index themgr eat rg eat random decision swap substre second substre orderrg eat rg e apply algorithm recursively divide atrg e rg e random decision substring orderthe algorithm stop result stre rgeat s2a possible scenario lead s1 scramble s2 return trueexample 2input s1 abcde s2 caebdoutput falseexample 3input s1 s2 aoutput true constraintss1length s2length1 s1length 30s1 s2 consist lowercase english letter