title: Check String Follows Anbn Pattern Not
signature: checkStringFollowsAnbnPatternNot(str) {
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(str, bool expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(str), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          "ba", 
          false)
      }");
  
      print("TEST-1...${driver(
          "aabb", 
          true)
      }");
  
      print("TEST-2...${driver(
          "abab", 
          false)
      }");
  
      print("TEST-3...${driver(
          "aaabb", 
          false)
      }");
  
      print("TEST-4...${driver(
          "aabbb", 
          false)
      }");
  
      print("TEST-5...${driver(
          "abaabbaa", 
          false)
      }");
  
      print("TEST-6...${driver(
          "abaababb", 
          false)
      }");
  
      print("TEST-7...${driver(
          "bbaa", 
          false)
      }");
  
      print("TEST-8...${driver(
          "11001000", 
          false)
      }");
  
      print("TEST-9...${driver(
          "ZWXv te", 
          false)
      }");
  
      return 0;
  }
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;
  }