title: What is wrong in this code in this problem
body: <p>Suppose you have a string, S, made up of only 'a's and 'b's. Write a recursive function that checks if the string was generated using the following rules:
  a. The string begins with an 'a'
  b. Each 'a' is followed by nothing or an 'a' or &quot;bb&quot;
  c. Each &quot;bb&quot; is followed by nothing or an 'a'
  If all the rules are followed by the given string, return true otherwise return false.
  Input format :
  String S
  Output format :
  'true' or 'false'</p>
  <pre><code>int length(char input[]) {
      int count=0;
      for(int i=0;input[i]!='\0';i++) {
          count++;
      } 
      return count;
  }
  bool checkAB(char input[], int start, int end) {
      // Write your code here
      if(start==end) {
          return true;
      }
      if(input[start]!='a') {
          return false;
      }
      if(input[start+1]=='a') {
          checkAB(input,start+1,end);
      }
      if(input[start+1]=='b'&amp;&amp;input[start+2]=='b') {
              checkAB(input,start+3,end);
      }
      
  }
  bool checkAB(char input[]) {
      int len=length(input);
      return checkAB(input,0,len);
  }
  </code></pre>
  <p>its working for all cases except for cases like aba abababa?
  So what's wrong in my code</p>