#include <stdio.h>


#define f(s)strlen(s)==2*strcspn(s,"b")&*(strrchr(s,97)+1)>97

int main(void) {
	printf("%d\n", f("aaabab"));
	return 0;
}
