title: Check String Follows Anbn Pattern Not
signature: fun checkStringFollowsAnbnPatternNot(str: String): Boolean {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": false, "inputs": {"str": "ba"}}, {"idx": 1, "outputs": true, "inputs": {"str": "aabb"}}, {"idx": 2, "outputs": false, "inputs": {"str": "abab"}}, {"idx": 3, "outputs": false, "inputs": {"str": "aaabb"}}, {"idx": 4, "outputs": false, "inputs": {"str": "aabbb"}}, {"idx": 5, "outputs": false, "inputs": {"str": "abaabbaa"}}, {"idx": 6, "outputs": false, "inputs": {"str": "abaababb"}}, {"idx": 7, "outputs": false, "inputs": {"str": "bbaa"}}, {"idx": 8, "outputs": false, "inputs": {"str": "11001000"}}, {"idx": 9, "outputs": false, "inputs": {"str": "ZWXv te"}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Boolean, expected:Boolean):Boolean{
    return actual.equals(expected)
  }
  fun driver(str: String, expected:Boolean):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(str), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver("ba", false)
      println("TEST-0...${result}")
      
      result = driver("aabb", true)
      println("TEST-1...${result}")
      
      result = driver("abab", false)
      println("TEST-2...${result}")
      
      result = driver("aaabb", false)
      println("TEST-3...${result}")
      
      result = driver("aabbb", false)
      println("TEST-4...${result}")
      
      result = driver("abaabbaa", false)
      println("TEST-5...${result}")
      
      result = driver("abaababb", false)
      println("TEST-6...${result}")
      
      result = driver("bbaa", false)
      println("TEST-7...${result}")
      
      result = driver("11001000", false)
      println("TEST-8...${result}")
      
      result = driver("ZWXv te", false)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: checkStringFollowsAnbnPatternNot
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn