title: Check Occurrences Character Appear Together
signature: class Solution {
  
      public Boolean checkOccurrencesCharacterAppearTogether(String s, Character c) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String s, Character c, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(s, c,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("gILrzLimS", 'm', true);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("307471222", '2', true);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("110", '0', true);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("GcAB", 'v', true);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("113", '3', true);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("011110010", '0', false);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("wcwob", 'w', false);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("74571582216153", '1', false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("100000011", '0', true);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution("ryPErkzY", 'q', true);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String s, Character c, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(s, c),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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;
  }