title: Count Characters String Distance English Alphabets
signature: function countCharactersStringDistanceEnglishAlphabets(str1) {
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(str1, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(str1),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("smnKL", 2);
    console.log(`TEST-0...${result}`);
  
    result = driver("270083", 3);
    console.log(`TEST-1...${result}`);
  
    result = driver("0", 0);
    console.log(`TEST-2...${result}`);
  
    result = driver("kcZdsz", 0);
    console.log(`TEST-3...${result}`);
  
    result = driver("483544224", 7);
    console.log(`TEST-4...${result}`);
  
    result = driver("000011", 1);
    console.log(`TEST-5...${result}`);
  
    result = driver("WysGCirMwKBzP", 3);
    console.log(`TEST-6...${result}`);
  
    result = driver("3366", 1);
    console.log(`TEST-7...${result}`);
  
    result = driver("110", 1);
    console.log(`TEST-8...${result}`);
  
    result = driver("NlaMkpCjUgg", 2);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    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;
  }