title: Number Substrings String
signature: number_substrings_string <- function(str) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(str, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(str), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          "gZFGZsHCimLf", 
          78L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          "505357", 
          21L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          "011011101", 
          45L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          "ovfwP Osauz", 
          66L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          "92132238746026", 
          105L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          "01100", 
          15L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          "RaOWYQRfiWKSyC", 
          105L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          "861330202", 
          45L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          "001100010", 
          45L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          "uvpKlGUBLOMba", 
          91L
      )))
  
  }
  
  main()
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;
  }