If the flag is true and both pointers points to their end of respective Strings then it is possible to transformed str1 into str2 , otherwise not .
if ( flag && ptr1 == str1 . length && ptr2 == str2 . length ) { document . write ( " " + " " ) ; } else { document . write ( " " + " " ) ; } }