title: Perfect Reversible String
signature: function perfect_reversible_string(str)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(str, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(str), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("ab", false);
      @printf("TEST-0...%s\n",result);
      
      result = driver("303", true);
      @printf("TEST-1...%s\n",result);
      
      result = driver("11110000", false);
      @printf("TEST-2...%s\n",result);
      
      result = driver("aba", true);
      @printf("TEST-3...%s\n",result);
      
      result = driver("404", true);
      @printf("TEST-4...%s\n",result);
      
      result = driver("10101", true);
      @printf("TEST-5...%s\n",result);
      
      result = driver("abab", false);
      @printf("TEST-6...%s\n",result);
      
      result = driver("6366", false);
      @printf("TEST-7...%s\n",result);
      
      result = driver("001", false);
      @printf("TEST-8...%s\n",result);
      
      result = driver("", true);
      @printf("TEST-9...%s\n",result);
      
  end
  
  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;
  }