title: Check Occurrences Character Appear Together
signature: def check_occurrences_character_appear_together(s, c):
test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(s, c, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              s, c),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver("gILrzLimS", 'm', True)
      print(f"TEST-0...{result}")
  
      result = driver("307471222", '2', True)
      print(f"TEST-1...{result}")
  
      result = driver("110", '0', True)
      print(f"TEST-2...{result}")
  
      result = driver("GcAB", 'v', True)
      print(f"TEST-3...{result}")
  
      result = driver("113", '3', True)
      print(f"TEST-4...{result}")
  
      result = driver("011110010", '0', False)
      print(f"TEST-5...{result}")
  
      result = driver("wcwob", 'w', False)
      print(f"TEST-6...{result}")
  
      result = driver("74571582216153", '1', False)
      print(f"TEST-7...{result}")
  
      result = driver("100000011", '0', True)
      print(f"TEST-8...{result}")
  
      result = driver("ryPErkzY", 'q', True)
      print(f"TEST-9...{result}")
  
      sys.exit(0)
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;
  }