title: Google Case Given Sentence
signature: google_case_given_sentence <- function(s) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(s, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(s), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          "TEYndweqZA", 
          "tEYNDWEQZA"
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          "01865", 
          "01865"
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          "11001100", 
          "11001100"
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          "CzwznJmQet", 
          "cZWZNJMQET"
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          "318305446", 
          "318305446"
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          "0000001111110", 
          "0000001111110"
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          "yzT", 
          "yZT"
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          "38630230", 
          "38630230"
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          "01101", 
          "01101"
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          "zoizI", 
          "zOIZI"
      )))
  
  }
  
  main()
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;
  }