title: Count Characters String Distance English Alphabets
signature: func countCharactersStringDistanceEnglishAlphabets(str1 string) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(str1 string, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(str1),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver("smnKL", 2)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver("270083", 3)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver("0", 0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver("kcZdsz", 0)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver("483544224", 7)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver("000011", 1)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver("WysGCirMwKBzP", 3)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver("3366", 1)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver("110", 1)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver("NlaMkpCjUgg", 2)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }