title: Check Occurrences Character Appear Together
signature: function checkOccurrencesCharacterAppearTogether($s, $c) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($s, $c, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($s, $c), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        "gILrzLimS", 'm', 
        true));
      
      printf("TEST-1...%s\n",driver(
        "307471222", '2', 
        true));
      
      printf("TEST-2...%s\n",driver(
        "110", '0', 
        true));
      
      printf("TEST-3...%s\n",driver(
        "GcAB", 'v', 
        true));
      
      printf("TEST-4...%s\n",driver(
        "113", '3', 
        true));
      
      printf("TEST-5...%s\n",driver(
        "011110010", '0', 
        false));
      
      printf("TEST-6...%s\n",driver(
        "wcwob", 'w', 
        false));
      
      printf("TEST-7...%s\n",driver(
        "74571582216153", '1', 
        false));
      
      printf("TEST-8...%s\n",driver(
        "100000011", '0', 
        true));
      
      printf("TEST-9...%s\n",driver(
        "ryPErkzY", 'q', 
        true));
      
  }
  
  main();
  ?>
source_py: def check_occurrences_character_appear_together(s, c):
      oneSeen = False
      i = 0
      n = len(s)
      while (i < n):
          if (s[i] == c):
              if (oneSeen == True):
                  return False
              while ((i < n) and (s[i] == c)):
                  i = (i + 1)
              oneSeen = True
          else:
              i = (i + 1)
      return True
source_cpp: bool check_occurrences_character_appear_together(string s, char c) {
    bool oneSeen = false;
    int i = 0, n = s . length ( );
    while ( i < n ) {
      if ( s [ i ] == c ) {
        if ( oneSeen == true ) return false;
        while ( i < n && s [ i ] == c ) i ++;
        oneSeen = true;
      }
      else i ++;
    }
    return true;
  }