title: Count Characters String Distance English Alphabets
signature: function countCharactersStringDistanceEnglishAlphabets($str1) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($str1, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($str1), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        "smnKL", 
        2));
      
      printf("TEST-1...%s\n",driver(
        "270083", 
        3));
      
      printf("TEST-2...%s\n",driver(
        "0", 
        0));
      
      printf("TEST-3...%s\n",driver(
        "kcZdsz", 
        0));
      
      printf("TEST-4...%s\n",driver(
        "483544224", 
        7));
      
      printf("TEST-5...%s\n",driver(
        "000011", 
        1));
      
      printf("TEST-6...%s\n",driver(
        "WysGCirMwKBzP", 
        3));
      
      printf("TEST-7...%s\n",driver(
        "3366", 
        1));
      
      printf("TEST-8...%s\n",driver(
        "110", 
        1));
      
      printf("TEST-9...%s\n",driver(
        "NlaMkpCjUgg", 
        2));
      
  }
  
  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;
  }