title: Google Case Given Sentence
signature: function google_case_given_sentence(s)
source_py: def google_case_given_sentence(s):
      n = len(s)
      s1 = ''
      s1 = (s1 + s[0].lower())
      i = 1
      while (i < n):
          if ((s[i] == ' ') and (i <= n)):
              s1 = ((s1 + ' ') + s[(i + 1)].lower())
              i = (i + 1)
          else:
              s1 = (s1 + s[i].upper())
          i = (i + 1)
      return s1
source_cpp: string google_case_given_sentence(string s) {
    int n = s . length ( );
    s [ 0 ] = tolower ( s [ 0 ] );
    for ( int i = 1;
    i < n;
    i ++ ) {
      if ( s [ i ] == ' ' && i < n ) {
        s [ i + 1 ] = tolower ( s [ i + 1 ] );
        i ++;
      }
      else s [ i ] = toupper ( s [ i ] );
    }
    return s;
  }
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(s, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(s) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver("TEYndweqZA", "tEYNDWEQZA")
      print(string.format("TEST-0...%s",result))
  
      result = driver("01865", "01865")
      print(string.format("TEST-1...%s",result))
  
      result = driver("11001100", "11001100")
      print(string.format("TEST-2...%s",result))
  
      result = driver("CzwznJmQet", "cZWZNJMQET")
      print(string.format("TEST-3...%s",result))
  
      result = driver("318305446", "318305446")
      print(string.format("TEST-4...%s",result))
  
      result = driver("0000001111110", "0000001111110")
      print(string.format("TEST-5...%s",result))
  
      result = driver("yzT", "yZT")
      print(string.format("TEST-6...%s",result))
  
      result = driver("38630230", "38630230")
      print(string.format("TEST-7...%s",result))
  
      result = driver("01101", "01101")
      print(string.format("TEST-8...%s",result))
  
      result = driver("zoizI", "zOIZI")
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": "tEYNDWEQZA", "inputs": {"s": "TEYndweqZA"}}, {"idx": 1, "outputs": "01865", "inputs": {"s": "01865"}}, {"idx": 2, "outputs": "11001100", "inputs": {"s": "11001100"}}, {"idx": 3, "outputs": "cZWZNJMQET", "inputs": {"s": "CzwznJmQet"}}, {"idx": 4, "outputs": "318305446", "inputs": {"s": "318305446"}}, {"idx": 5, "outputs": "0000001111110", "inputs": {"s": "0000001111110"}}, {"idx": 6, "outputs": "yZT", "inputs": {"s": "yzT"}}, {"idx": 7, "outputs": "38630230", "inputs": {"s": "38630230"}}, {"idx": 8, "outputs": "01101", "inputs": {"s": "01101"}}, {"idx": 9, "outputs": "zOIZI", "inputs": {"s": "zoizI"}}]
question_info.extension: lua
question_info.entry_fn_name: google_case_given_sentence
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__