title: Count Characters String Distance English Alphabets
signature: count_characters_string_distance_english_alphabets <- function(str1) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(str1, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(str1), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          "smnKL", 
          2L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          "270083", 
          3L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          "0", 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          "kcZdsz", 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          "483544224", 
          7L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          "000011", 
          1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          "WysGCirMwKBzP", 
          3L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          "3366", 
          1L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          "110", 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          "NlaMkpCjUgg", 
          2L
      )))
  
  }
  
  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;
  }