title: Perfect Reversible String
signature: function perfectReversibleString(str) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(str, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(str),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("ab", false);
    console.log(`TEST-0...${result}`);
  
    result = driver("303", true);
    console.log(`TEST-1...${result}`);
  
    result = driver("11110000", false);
    console.log(`TEST-2...${result}`);
  
    result = driver("aba", true);
    console.log(`TEST-3...${result}`);
  
    result = driver("404", true);
    console.log(`TEST-4...${result}`);
  
    result = driver("10101", true);
    console.log(`TEST-5...${result}`);
  
    result = driver("abab", false);
    console.log(`TEST-6...${result}`);
  
    result = driver("6366", false);
    console.log(`TEST-7...${result}`);
  
    result = driver("001", false);
    console.log(`TEST-8...${result}`);
  
    result = driver("", true);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
source_py: def perfect_reversible_string(str):
      i = 0
      j = (len(str) - 1)
      while (i < j):
          if (str[i] != str[j]):
              return False
          i += 1
          j -= 1
      return True
source_cpp: bool perfect_reversible_string(string str) {
    int i = 0, j = str . length ( ) - 1;
    while ( i < j ) {
      if ( str [ i ] != str [ j ] ) return false;
      i ++;
      j --;
    }
    return true;
  }