title: Check Occurrences Character Appear Together
signature: checkOccurrencesCharacterAppearTogether(s, c) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(bool actual, bool expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(s, c, bool expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(s, c), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          "gILrzLimS", 'm', 
          true)
      }");
  
      print("TEST-1...${driver(
          "307471222", '2', 
          true)
      }");
  
      print("TEST-2...${driver(
          "110", '0', 
          true)
      }");
  
      print("TEST-3...${driver(
          "GcAB", 'v', 
          true)
      }");
  
      print("TEST-4...${driver(
          "113", '3', 
          true)
      }");
  
      print("TEST-5...${driver(
          "011110010", '0', 
          false)
      }");
  
      print("TEST-6...${driver(
          "wcwob", 'w', 
          false)
      }");
  
      print("TEST-7...${driver(
          "74571582216153", '1', 
          false)
      }");
  
      print("TEST-8...${driver(
          "100000011", '0', 
          true)
      }");
  
      print("TEST-9...${driver(
          "ryPErkzY", 'q', 
          true)
      }");
  
      return 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;
  }