Problem

Source: New Zealand NZMOC Camp Selection Problems 2014 p10

Tags: Words, combinatorics



In the land of Microbablia the alphabet has only two letters, ‘A’ and ‘B’. Not surprisingly, the inhabitants are obsessed with the band ABBA. Words in the local dialect with a high ABBA-factor are considered particularly lucky. To compute the ABBA-factor of a word you just count the number of occurrences of ABBA within the word (not necessarily consecutively). So for instance AABA has ABBA-factor $0$, ABBA has ABBA-factor $1$, AABBBA has ABBA-factor $6$, and ABBABBA has ABBA factor $8$. What is the greatest possible ABBA-factor for a $100$ letter word?