title: Count Characters String Distance English Alphabets
signature: function countCharactersStringDistanceEnglishAlphabets(str1: string): number {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": 2, "inputs": {"str1": "smnKL"}}, {"idx": 1, "outputs": 3, "inputs": {"str1": "270083"}}, {"idx": 2, "outputs": 0, "inputs": {"str1": "0"}}, {"idx": 3, "outputs": 0, "inputs": {"str1": "kcZdsz"}}, {"idx": 4, "outputs": 7, "inputs": {"str1": "483544224"}}, {"idx": 5, "outputs": 1, "inputs": {"str1": "000011"}}, {"idx": 6, "outputs": 3, "inputs": {"str1": "WysGCirMwKBzP"}}, {"idx": 7, "outputs": 1, "inputs": {"str1": "3366"}}, {"idx": 8, "outputs": 1, "inputs": {"str1": "110"}}, {"idx": 9, "outputs": 2, "inputs": {"str1": "NlaMkpCjUgg"}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(str1: string, expected:number): string {
      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}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: countCharactersStringDistanceEnglishAlphabets
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js