title: Number Substrings String
signature: fun numberSubstringsString(str: String): Int {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": 78, "inputs": {"str": "gZFGZsHCimLf"}}, {"idx": 1, "outputs": 21, "inputs": {"str": "505357"}}, {"idx": 2, "outputs": 45, "inputs": {"str": "011011101"}}, {"idx": 3, "outputs": 66, "inputs": {"str": "ovfwP Osauz"}}, {"idx": 4, "outputs": 105, "inputs": {"str": "92132238746026"}}, {"idx": 5, "outputs": 15, "inputs": {"str": "01100"}}, {"idx": 6, "outputs": 105, "inputs": {"str": "RaOWYQRfiWKSyC"}}, {"idx": 7, "outputs": 45, "inputs": {"str": "861330202"}}, {"idx": 8, "outputs": 45, "inputs": {"str": "001100010"}}, {"idx": 9, "outputs": 91, "inputs": {"str": "uvpKlGUBLOMba"}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(str: String, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(str), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver("gZFGZsHCimLf", 78)
      println("TEST-0...${result}")
      
      result = driver("505357", 21)
      println("TEST-1...${result}")
      
      result = driver("011011101", 45)
      println("TEST-2...${result}")
      
      result = driver("ovfwP Osauz", 66)
      println("TEST-3...${result}")
      
      result = driver("92132238746026", 105)
      println("TEST-4...${result}")
      
      result = driver("01100", 15)
      println("TEST-5...${result}")
      
      result = driver("RaOWYQRfiWKSyC", 105)
      println("TEST-6...${result}")
      
      result = driver("861330202", 45)
      println("TEST-7...${result}")
      
      result = driver("001100010", 45)
      println("TEST-8...${result}")
      
      result = driver("uvpKlGUBLOMba", 91)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: numberSubstringsString
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn