Update app.js

Added a function to find the first "BA" combination after the first "B".