title: Count Characters String Distance English Alphabets
signature: function count_characters_string_distance_english_alphabets(str1)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(str1, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(str1), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("smnKL", 2);
      @printf("TEST-0...%s\n",result);
      
      result = driver("270083", 3);
      @printf("TEST-1...%s\n",result);
      
      result = driver("0", 0);
      @printf("TEST-2...%s\n",result);
      
      result = driver("kcZdsz", 0);
      @printf("TEST-3...%s\n",result);
      
      result = driver("483544224", 7);
      @printf("TEST-4...%s\n",result);
      
      result = driver("000011", 1);
      @printf("TEST-5...%s\n",result);
      
      result = driver("WysGCirMwKBzP", 3);
      @printf("TEST-6...%s\n",result);
      
      result = driver("3366", 1);
      @printf("TEST-7...%s\n",result);
      
      result = driver("110", 1);
      @printf("TEST-8...%s\n",result);
      
      result = driver("NlaMkpCjUgg", 2);
      @printf("TEST-9...%s\n",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;
  }