Are They Same Problem

I am not able to write code for this problem
as i have no idea how to compare 4 strings at each level of division (Divide And Conquer).

Please guide me.

Hi Manoj

Hint 1->
It is based on divide and conquer approach.
try to form the recursive solution.
and think of the base case.

Hint 2->

let equivalent(a,b) tell us is a and b are equivalent or not so the algo for the function goes like this:

bool equivalent( string a, string b)
{
if( a.length()!=b.length()) // Base case
return false;

if(a==b) // Base case
return true;

// a1+a2=a and b1+b2=b

if(equivalent(a1,b1)==true && equivalent(a2,b2) ==true ) // Divide
return true;

if(equivalent(a1,b2)==true && equivalent(a2,b1) ==true ) // Divide
return true;

return false;
}

this is an algorithm for the function.
Hit like if you get it. :stuck_out_tongue:

Post your doubt if you still have it.

Sir I am getting run-error in 1 test case. what is run-error?
Solution Link-https://ide.codingblocks.com/s/67285