title: Number Substrings String
signature: function number_substrings_string(str)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(str, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(str), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("gZFGZsHCimLf", 78);
      @printf("TEST-0...%s\n",result);
      
      result = driver("505357", 21);
      @printf("TEST-1...%s\n",result);
      
      result = driver("011011101", 45);
      @printf("TEST-2...%s\n",result);
      
      result = driver("ovfwP Osauz", 66);
      @printf("TEST-3...%s\n",result);
      
      result = driver("92132238746026", 105);
      @printf("TEST-4...%s\n",result);
      
      result = driver("01100", 15);
      @printf("TEST-5...%s\n",result);
      
      result = driver("RaOWYQRfiWKSyC", 105);
      @printf("TEST-6...%s\n",result);
      
      result = driver("861330202", 45);
      @printf("TEST-7...%s\n",result);
      
      result = driver("001100010", 45);
      @printf("TEST-8...%s\n",result);
      
      result = driver("uvpKlGUBLOMba", 91);
      @printf("TEST-9...%s\n",result);
      
  end
  
  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;
  }