title: Check Occurrences Character Appear Together
signature: function checkOccurrencesCharacterAppearTogether(s, c) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(s, c, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(s, c),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("gILrzLimS", 'm', true);
    console.log(`TEST-0...${result}`);
  
    result = driver("307471222", '2', true);
    console.log(`TEST-1...${result}`);
  
    result = driver("110", '0', true);
    console.log(`TEST-2...${result}`);
  
    result = driver("GcAB", 'v', true);
    console.log(`TEST-3...${result}`);
  
    result = driver("113", '3', true);
    console.log(`TEST-4...${result}`);
  
    result = driver("011110010", '0', false);
    console.log(`TEST-5...${result}`);
  
    result = driver("wcwob", 'w', false);
    console.log(`TEST-6...${result}`);
  
    result = driver("74571582216153", '1', false);
    console.log(`TEST-7...${result}`);
  
    result = driver("100000011", '0', true);
    console.log(`TEST-8...${result}`);
  
    result = driver("ryPErkzY", 'q', true);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    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;
  }