title: Check Occurrences Character Appear Together
signature: checkOccurrencesCharacterAppearTogether :: String -> Char -> Bool
  checkOccurrencesCharacterAppearTogether s c = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Bool -> Bool -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: String -> Char -> Bool -> String
  driver s c expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME s c) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      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) )
  
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;
  }