title: Number Substrings String
signature: func numberSubstringsString(str 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(str string, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(str),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver("gZFGZsHCimLf", 78)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver("505357", 21)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver("011011101", 45)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver("ovfwP Osauz", 66)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver("92132238746026", 105)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver("01100", 15)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver("RaOWYQRfiWKSyC", 105)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver("861330202", 45)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver("001100010", 45)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver("uvpKlGUBLOMba", 91)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def number_substrings_string(str):
      n = len(str)
      return int(((n * (n + 1)) / 2))
source_cpp: int number_substrings_string(string str) {
    int n = str . length ( );
    return n * ( n + 1 ) / 2;
  }