title: Check String Follows Anbn Pattern Not
signature: function checkStringFollowsAnbnPatternNot(str) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(str, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(str),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("ba", false);
    console.log(`TEST-0...${result}`);
  
    result = driver("aabb", true);
    console.log(`TEST-1...${result}`);
  
    result = driver("abab", false);
    console.log(`TEST-2...${result}`);
  
    result = driver("aaabb", false);
    console.log(`TEST-3...${result}`);
  
    result = driver("aabbb", false);
    console.log(`TEST-4...${result}`);
  
    result = driver("abaabbaa", false);
    console.log(`TEST-5...${result}`);
  
    result = driver("abaababb", false);
    console.log(`TEST-6...${result}`);
  
    result = driver("bbaa", false);
    console.log(`TEST-7...${result}`);
  
    result = driver("11001000", false);
    console.log(`TEST-8...${result}`);
  
    result = driver("ZWXv te", false);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
source_py: def check_string_follows_anbn_pattern_not(str):
      n = len(str)
      for i in range(n):
          if (str[i] != 'a'):
              break
      if ((i * 2) != n):
          return False
      for j in range(i, n):
          if (str[j] != 'b'):
              return False
      return True
source_cpp: bool check_string_follows_anbn_pattern_not(string str) {
    int n = str . length ( );
    int i;
    for ( i = 0;
    i < n;
    i ++ ) if ( str [ i ] != 'a' ) break;
    if ( i * 2 != n ) return false;
    int j;
    for ( j = i;
    j < n;
    j ++ ) if ( str [ j ] != 'b' ) return false;
    return true;
  }