title: Number Substrings String
signature: function numberSubstringsString(str) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(str, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(str),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("gZFGZsHCimLf", 78);
    console.log(`TEST-0...${result}`);
  
    result = driver("505357", 21);
    console.log(`TEST-1...${result}`);
  
    result = driver("011011101", 45);
    console.log(`TEST-2...${result}`);
  
    result = driver("ovfwP Osauz", 66);
    console.log(`TEST-3...${result}`);
  
    result = driver("92132238746026", 105);
    console.log(`TEST-4...${result}`);
  
    result = driver("01100", 15);
    console.log(`TEST-5...${result}`);
  
    result = driver("RaOWYQRfiWKSyC", 105);
    console.log(`TEST-6...${result}`);
  
    result = driver("861330202", 45);
    console.log(`TEST-7...${result}`);
  
    result = driver("001100010", 45);
    console.log(`TEST-8...${result}`);
  
    result = driver("uvpKlGUBLOMba", 91);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    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;
  }