title: Number Substrings String
signature: function numberSubstringsString($str) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($str, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($str), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        "gZFGZsHCimLf", 
        78));
      
      printf("TEST-1...%s\n",driver(
        "505357", 
        21));
      
      printf("TEST-2...%s\n",driver(
        "011011101", 
        45));
      
      printf("TEST-3...%s\n",driver(
        "ovfwP Osauz", 
        66));
      
      printf("TEST-4...%s\n",driver(
        "92132238746026", 
        105));
      
      printf("TEST-5...%s\n",driver(
        "01100", 
        15));
      
      printf("TEST-6...%s\n",driver(
        "RaOWYQRfiWKSyC", 
        105));
      
      printf("TEST-7...%s\n",driver(
        "861330202", 
        45));
      
      printf("TEST-8...%s\n",driver(
        "001100010", 
        45));
      
      printf("TEST-9...%s\n",driver(
        "uvpKlGUBLOMba", 
        91));
      
  }
  
  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;
  }