title: Count Characters String Distance English Alphabets
signature: class Solution {
  
      public Integer countCharactersStringDistanceEnglishAlphabets(String str1) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String str1, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(str1,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("smnKL", 2);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("270083", 3);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("0", 0);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("kcZdsz", 0);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("483544224", 7);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("000011", 1);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("WysGCirMwKBzP", 3);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("3366", 1);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("110", 1);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution("NlaMkpCjUgg", 2);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String str1, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(str1),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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;
  }