title: Count Characters String Distance English Alphabets
signature: function count_characters_string_distance_english_alphabets(str1)
test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(str1, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(str1) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver("smnKL", 2)
      print(string.format("TEST-0...%s",result))
  
      result = driver("270083", 3)
      print(string.format("TEST-1...%s",result))
  
      result = driver("0", 0)
      print(string.format("TEST-2...%s",result))
  
      result = driver("kcZdsz", 0)
      print(string.format("TEST-3...%s",result))
  
      result = driver("483544224", 7)
      print(string.format("TEST-4...%s",result))
  
      result = driver("000011", 1)
      print(string.format("TEST-5...%s",result))
  
      result = driver("WysGCirMwKBzP", 3)
      print(string.format("TEST-6...%s",result))
  
      result = driver("3366", 1)
      print(string.format("TEST-7...%s",result))
  
      result = driver("110", 1)
      print(string.format("TEST-8...%s",result))
  
      result = driver("NlaMkpCjUgg", 2)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
source_py: def count_characters_string_distance_english_alphabets(str1):
      result = 0
      n = len(str1)
      for i in range(0, n):
          for j in range((i + 1), n):
              if (abs((ord(str1[i]) - ord(str1[j]))) == abs((i - j))):
                  result += 1
      return result
source_cpp: int count_characters_string_distance_english_alphabets(string str) {
    int result = 0;
    int n = str . length ( );
    for ( int i = 0;
    i < n;
    i ++ ) for ( int j = i + 1;
    j < n;
    j ++ ) if ( abs ( str [ i ] - str [ j ] ) == abs ( i - j ) ) result ++;
    return result;
  }