title: Check Occurrences Character Appear Together
signature: function check_occurrences_character_appear_together(s, c)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(s, c, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(s, c), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("gILrzLimS", 'm', true);
      @printf("TEST-0...%s\n",result);
      
      result = driver("307471222", '2', true);
      @printf("TEST-1...%s\n",result);
      
      result = driver("110", '0', true);
      @printf("TEST-2...%s\n",result);
      
      result = driver("GcAB", 'v', true);
      @printf("TEST-3...%s\n",result);
      
      result = driver("113", '3', true);
      @printf("TEST-4...%s\n",result);
      
      result = driver("011110010", '0', false);
      @printf("TEST-5...%s\n",result);
      
      result = driver("wcwob", 'w', false);
      @printf("TEST-6...%s\n",result);
      
      result = driver("74571582216153", '1', false);
      @printf("TEST-7...%s\n",result);
      
      result = driver("100000011", '0', true);
      @printf("TEST-8...%s\n",result);
      
      result = driver("ryPErkzY", 'q', true);
      @printf("TEST-9...%s\n",result);
      
  end
  
  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;
  }